

Each time you create a JavaScript function, JavaScript automatically adds a prototype to that function. Much more can be said about Javascript prototype. Prototypes are a built-in feature of JavaScript. _proto_ is Javascript's way to reference the original blueprint's prototype features.That syntax is standard and optimized for in implementations, and quite different from.

See: object initializer / literal syntax. That blueprint contains features under prototype (that you can add/modify) The proto property can also be used in an object literal definition to set the object Prototype on creation, as an alternative to Object.create ().Anything we create in javascript references methods and properties from its blueprint.If you look at its properties, you'll see yummy inside proto: (3) donut can use that new method we just created: donut.yummy() // "In my tummy" _proto_: Array(0) // console.log("In my tummy")Īny existing or future array will have this yummy method. Then expand the > icon, you will see that it has proto attribute: In you browser console, create an empty array ( ). What is that? Why does it sound like prototype and how is it different from prototype?Īs you are reading this, I highly recommend you to code along - open up chrome dev tool and follow along. On the other hand, if you inspect an object you just created, say an array const arr =, you'll see _proto_. You probably heard that Javascipt is a prototype based language.Īccording to MDN, it is how Javascript objects inherit features from one another.
