So Meta I Can't Take It!


I just could not understand what this exercise was all about. Can someone please elaborate? What was the learning here?



I don't know why but my code works.

// what is this "Object.prototype" anyway...?
var prototypeType = typeof Object.prototype;

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

Can someone explain me why and the objective of this exercise?


This is printing out the typeof of Object.prototype. It basically proves that it is an object type.

The second is to prove that Object.prototype has its own properties.

Now I need a codecademy moderator to explain
var hasOwn = Object.prototype.hasOwnProperty("hasOwnProperty");
Does this mean that the string value of hasOwnProperty is "hasOwnProperty"?


I also had trouble understanding the purpose of the string ("hasOwnProperty") if someone can help?


hasOwnProperty is a function that is a property in the Object in JavaScript, and that function checks if there is a property in a object. To clarify a bit the Object with the capital O is an already existing object in JavaScript. So when you type:

var myobject = new Object()
The Object is an existing object that has its own properties and you are making newObject inherit from Object.

I'm not 100% sure but I think that is how it works.