Why does:
console.log(Object.hasOwnProperty("hasOwnProperty"));
return a false, But:
console.log(Object.prototype.hasOwnProperty("hasOwnProperty"));
return a true statement?
I realize that hasOwnProperty is a pre-built method in the Object but I guess my question is what is the difference between the Object and the prototype of an Object.
Aren't they one and the same?
When we refer to the Object in the first line of code, aren't we referring to the same line of code in the second line of code above?
EDIT: fixed above 2 lines of code from:
console.log(Object.hasOwnProperty);
and:
console.log(Object.prototype.hasOwnProperty);
hasOwnPropertyis a function, I don't see how you can be gettingtrueorfalseon the console... can you provide some complete code that demonstrates what you're seeing? - DancrumbObject.prototype.hasOwnProperty === Object.hasOwnPropertyistrue- Dancrumb