这里需要注意一个地方,就是Object.prototype.isPrototypeOf()与instanceof的区别。请看下面的代码: var human=function(){} var socrates=Object.create(human);console.log(human.isPrototypeOf(socrates));true ...
就是Object.prototype.isPrototypeOf()与instanceof的区别。请看下面的代码&xff1a;var human&61;function(){} var socrates&61;Object.create(human);console.log(human.isPrototypeOf(socrates));true console.log...
想要了解更多内容,以及这种方式与类继承的区别,请阅读“3 Different Kinds of Prototypal Inheritance”. For more training in in prototypal inheritance techniques,factory functions,and object composition,...