JS 对象API之判断父对象是否在子对象的原型链上
语法:父对象.prototype.isPrototypeOf(子对象)
代码栗子:
function Student(){ this.name = "小马扎"; this.age = 18; } var sky = new Student(); var img = new Image(); console.log(Student.prototype.isPrototypeOf(sky)); // true console.log(Student.prototype.isPrototypeOf(img)); // false