So Meta I Can't Take It - theory?


Hey friends!

Question about this exercise:

I've resolved the exercise and my code is running correctly, but I am having some trouble with the theory/concept behind this exercise.

  1. What is object referred to in Object.prototype? We never created a new object here so where did this object come from?
  2. What is accomplished by adding .prototype to Object?
  3. Why do we pass "hasOwnProperty" as an argument in Object.prototype.hasOwnProperty?

Would love some help here. Thanks!

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

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


if we look at this documentation, we can see that Object is a constructor. (which is part of JavaScript)

we want to see what type prototype is, which is why we use typeof

.hasOwnProperty() is a method to see if an object has a certain properties/methods, we look if prototype has a property/method called hasOwnProperty, which it has


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