语法:父对象.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

 

相关文章: