JS理论-:一只tom猫告诉你构造函数 实例 实例原型 实例原型的实例原型是什么

参考地址:https://github.com/mqyqingfeng/Blog/issues/2 感谢这位大佬
下面说说我的理解:

第一,看下人物: tom--一只叫tom的猫 Cat()--猫的构造函数 cat_model---猫的原型(是只具有代表的猫)

第二,看下 tom是怎样被造出来的,是公猫和母猫吗?

附上代码:
var Cat(){
this.name=name
}

function objectFactory(){
var obj = new Object()
Constructor = [].shift.call(arguments)
obj.proto = Constructor.prototype
Constructor.apply(obj,arguments)
return typeof ret == 'object' ? ret:obj;
}

辣么 var tom = new Cat('tom') 和 var tom = objectFactory(Cat,'tom') 是一样的

原文地址:https://www.cnblogs.com/lelexiu/p/10162081.html