一、Object.create()
这个方法用于创建一个新对象。被创建的对象的__proto__ 指向create函数第一个参数的原型对象prototype,在创建新对象时可以通过create函数第二个参数指定一些属性。 
二、Object.hasOwnProperty()
- 对象是否有某一个属于自己的属性(不是在原型上的属性)

三、in/for in 操作符
判断某个属性是否在某个对象或者对象的原型上 
四、instanceof
用于检测构造函数的pototype ,是否出现在某个实例对象的原型链 上 
function createObject(o) {
function Fn() {}
Fn.prototype = o
return new Fn()
}
function inheritPrototype(SubType, SuperType) {
SubType.prototype = createObject(SuperType.prototype)
Object.defineProperty(SubType.prototype, 'constructor', {
enumerable: false,
configurable: true,
writable: true,
value: SubType
})
}
function Person() {
}
function Student() {
}
inheritPrototype(Student, Person)
var stu = new Student()
console.log(stu instanceof Student)
console.log(stu instanceof Person)
console.log(stu instanceof Object)
五、isPrototypeOf
用于检测某个对象 ,是否出现在某个实例对象的原型链上 
六、原型继承关系图


|