<script>
var myObject = function(name){
this.name = name;
return this;
};
myObject.prototype.getName = function(){
return this.name;
};
console.log(myObject instanceof Function); // true
</script>
问题:
如何理解这一行:console.log(myObject instanceof Function); // true
?如果我们要创建实例,我们需要使用new
关键字,对吗?比如:var myObject = new Function();
那么 myObject 怎么可能是 Function 的实例呢?