0

Whenever I open an object details in console.log, after the attached properties or functions I always see "_ proto _". What is this and why is it always present even though I never declared anything like this in my object? I know it is related to some prototype feature but not exactly sure. Also, whereever it exists, whether plain js, jquery, or Angular.js it has the exact same 13 functions below it, viz. defineGetter, defineSetter, ...., set_proto.

Can someone explain it?

enter image description here

Deadpool
  • 7,811
  • 9
  • 44
  • 88

1 Answers1

1

So whenever you make any object in JavaScript it inherited from Object. so a object in java script have this structure


private members

proto-Reference of the prototype of current object parent.

prototype- Reference of the current objects prototype


So if you make any object let say named as object1

var object1=new Object();

it will be inherited from Object. and have proto set to Object(you can think Object as root class).

Roli Agrawal
  • 2,356
  • 3
  • 23
  • 28