I didn't understood this topic and weird error occuring


#1


https://www.codecademy.com/en/courses/objects-ii/5/3?curriculum_id=506324b3a7dffd00020bf661


Make sure to set prototypeType to the typeof Object.prototype


// what is this "Object.prototype" anyway...?
var prototypeType = typeof(Object.prototype);
console.log(prototypeType);

// now let's examine it!
var hasOwn = Object.hasOwnProperty("prototype");
console.log(hasOwn);


#2

var prototypeType = typeof(Object.prototype);
console.log(prototypeType);

typeof operand // no braces

var hasOwn = Object.hasOwnProperty("prototype");
console.log(hasOwn);

Instructions

If all goes well, you should realize that Object.prototype itself is an object! And since all objects have the hasOwnProperty method....

var hasOwn = Object.prototype.hasOwnProperty('hasOwnProperty');

#3

That's fine but I didn't go the motive of this topic. What does it want to
tell me about hasOwnProperty and what is Object.prototype ?
Is here Object the built-in object ? What actually the meaning of the
prototype? What it actually does ? These questions aren't clear to me.

Thanks!


#4

Maybe you can read here more about it:

MDN - Object.prototype

MDN - Object.prototype.hasOwnProperty()


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.