Loading

Object.create() 为新对象,提供现有对象的__proto__

Object.create()方法创建一个新对象,使用现有的对象来提供新创建的对象的__proto__

function Animal () {}
function Dog () {}
Dog.prototype = Object.create(Animal.prototype)
document.write(Dog.prototype instanceof Animal)

 

posted @ 2019-08-19 21:45  fsdffsdf  阅读(160)  评论(0编辑  收藏  举报