This is the object which is created from a constructor function.
dunder proto === __proto__
Every object in JS has this property.
It points back to the prototype object of the constructor function that created that object.
Only Object.prototype.__proto__ === null
When a new function is created a new property is added to it. That property is named prototype. It's an object and initially has two properties:
- constructor: which points to the function itself;
- __proto__
If you have several objects that share the same implementation, you can use a constructor function to create them.
Any function can be a constructor function as long as it is invoked using the new keyword
function createSillyExample() {}
const objectCreatedFromSillyExample = new createSillyExample();
- a fn which uses only its arguments and/or local variables to compute its result
- a fn which does not cause side effects