Functions, in addition to the hidden [[prototype]] property, also have a property called prototype, and it is this that you can access, and modify, to provide inherited properties and methods for the objects you make. The
new
keyword does 4 things:
this
is mentioned.
Objects have prototype and [[prototype]] property. [[prototype]] property is set at object creation time.
Every object (including functions) has this internal property called[[prototype]]. It can only be set at object creation time, either withnew, withObject.create, or based on the literal (functions default to Function.prototype, numbers to Number.prototype, etc.). It can only be read withObject.getPrototypeOf(someObject). There isnoother way to set or read this value.
Recommended articles: