This note assumes familiarity with the following concepts:
- Sharing methods between object instances using the Prototype property.
- Creating objects that inherit properties from another object using Object.create when property access fails.
- Building constructor functions using Prototypal instantiation.
Pseudoclassical instantiation is a syntactic shortcut in JavaScript that leverages the new
keyword to implicitly perform Object.create
and return a new object whose prototype is set to the constructor’s prototype. This approach mimics classical object-oriented inheritance patterns while utilizing JavaScript’s prototypal underlying mechanism.
Omitting the new
keyword when instantiating an object with pseudoclassical instantiation results in neither the this
object being allocated nor the implicit return triggered. This is because the new
keyword is crucial for invoking the constructor function with the proper context and memory allocation.
References