New keyword
In JavaScript, new is an operator that creates an object instance by invoking a constructable function or class as its constructor.
Secrets of the JavaScript Ninja, Second Edition
A JavaScript operator that creates an object instance and invokes a constructor function with that object as its this value.
- How it is used
- Creates and initializes object instances by invoking functions as constructors.
- How deep it goes
- Explains object creation, `this`, prototype linkage, and return-value exceptions through contrasting calls and examples.
- Examples
- Contrasts ordinary and constructor calls, constructs two objects with methods, and tests primitive and object returns.
- What you can do after
- Build it from scratch: initialize instances with `new` and make methods available through a constructor's prototype.
Read how Secrets of the JavaScript Ninja, Second Edition explains new keyword →
The Joy of JavaScript
The JavaScript operator keyword that creates a new object instance by invoking a constructor function or class.
- How it is used
- Instantiates constructor-based objects and enables shared prototype behavior.
- How deep it goes
- Explains prototype links, constructor references, method sharing, and safeguards against improper calls.
- Examples
- Uses Transaction and HashTransaction instances, shared methods, TypeErrors, new.target, and Object.create prototype configuration.
- What you can do after
- Apply it via constructor functions to create instances with shared prototype methods and safer invocation behavior.
Related concepts
- constructor methoduses · A constructor is a type-associated operation or callable that creates or initializes an instance and establishes its initial state.
- prototypeuses · A JavaScript prototype is an object through which other objects can access properties and methods by delegation during lookup.
- thisuses · In JavaScript, the this value is determined by a function’s call context or, for an arrow function, inherited lexically.
- classused by · A class is a programming-language construct that defines a type’s structure or behavior and provides a basis for creating or representing objects.
- initializerused by · An initializer is a function, declaration, or language construct that establishes the initial value or state of an object, value, computation, or process.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

