javascript - Object.getPrototypeOf and example.isPrototypeOf(obj) gave confusing results -


i read object.geprototypeof(someobject) returns prototype of passed object , aprototype.isprototypeof(someobject) returns true if aprototype prototype of someobject. obvious me if object.getprototypeof(someobject) returns prototype named aprototype, aprototype.isprototypeof(someobject) return true. it's not happening in code:

function person(fname, lname) {   this.fname = fname;   this.lname = lname;    }  var arun = new person('arun', 'jaiswal');  console.log(object.getprototypeof(arun));  //person console.log(person.isprototypeof(arun));   //false 

what's wrong?

as per mdn, syntax of isprototype

prototypeobj.isprototypeof(obj) 

also refer isprototypeof vs instanceof

function person(fname, lname)  {    this.fname = fname;    this.lname = lname;     }    var arun = new person('arun', 'jaiswal');    console.log(object.getprototypeof(arun));  //person  console.log(person.prototype.isprototypeof(arun));


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -