What is the __proto__ value of an object that is being created by constructor

Viewed 39

I know that it seems that there is a lot of reference in the net or books for my question, but believe me that if i'm asking it's mean that after reading books/seeing videos i'm very confused. So please try to help without judging :) I have the following code:

  const Person = function (firstName, birthYear) {
  // Instance properties
  this.firstName = firstName;
  this.birthYear = birthYear;

I'm creating an object of Person:

let p = new Person('Mike',35)

Then when printing p to console is see that the proto property is from Object type and not a Person type. Am i reading it wrong or i don't understand the prototype theory?

enter image description here

My miss confuse maybe from a lecture i saw: enter image description here

1 Answers

__proto__ points to Person.prototype in this case

Edit: Ahhh, I finally see what you're asking, you were thinking in another Programing language where there's "type". You see in JS, function is an Object. There's no class. Every Object you created will be type "Object".

Related