When a function is called with the new keyword, a new object is created and that object becomes the context of the function call. That context is available within the function using the this keyword. If the function does not explicitly return anything in its body, the result of evaluating the function with the new keyword will be the new object.
Constructors are not the only way to create JavaScript objects. Object.create creates a new JavaScript object and permits you to specify the prototype. Using Object.create, we can be explicit about what objects are create with what prototypes.
So, you can use new or you can use Object.create to create new objects with prototypes. So far, so good.
But there are some clouds on the horizon.
Your new post is loading...