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 →
Secrets of the JavaScript Ninja, Third Edition
The new operator invokes a constructable function, creates an object for its this value, and returns the constructed object subject to explicit-return rules.
- How it is used
- Invokes a constructor to initialize an object with that object as the function’s `this` value.
- How deep it goes
- Explains object creation, `this`, return behavior, and prototype inheritance without detailing lower-level runtime implementation.
- Examples
- Uses Ninja constructors, instance methods, and a prototype-defined method to demonstrate construction and inheritance.
- What you can do after
- Build it from scratch by invoking a constructor to initialize objects and inherit prototype methods.
Read how Secrets of the JavaScript Ninja, Third Edition explains new keyword →
JavaScript in Depth
A JavaScript operator that creates an object, links its prototype, invokes a constructor with that object as this, and determines the expression result from the constructor return value.
- How it is used
- Explains construction as a mechanism for reasoning about prototypes, this binding, constructor returns, and surprising instance behavior.
- How deep it goes
- Traces four construction steps and return selection, then stops short of detailed runtime implementation beyond internal prototype and binding concepts.
- Examples
- Uses Gadget, simulated construction, object-returning constructors, primitive-returning constructors, and new.target logging.
- What you can do after
- Diagnose unexpected instances by tracing prototype linkage, constructor this, return replacement, and construction detection.
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.
Also covered in
- Pro Angular 16
- Essential TypeScript 5, Third Edition
- Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond
What to know first
- thisIn JavaScript, the this value is determined by a function’s call context or, for an arrow function, inherited lexically.
- objectAn object is a distinct entity represented or manipulated within a computational system, typically as a value, data structure, resource, or instance of a type.
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- arrow functionAn arrow function is a JavaScript function expression written with arrow syntax that uses lexical binding for this and has no own arguments object.
Related concepts
- constructor methoduses · A constructor method is a type-associated operation involved in creating an instance and establishing 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 and behavior and provides a basis for creating or representing objects.
- keywordkind of · A language-defined word or token with a predefined syntactic or semantic role, which may be restricted from use as an ordinary identifier.
Questions about new keyword
What is new keyword?
In JavaScript, new is an operator that creates an object instance by invoking a constructable function or class as its constructor.
Which Manning books explain new keyword?
Secrets of the JavaScript Ninja, Second Edition, Secrets of the JavaScript Ninja, Third Edition, JavaScript in Depth and The Joy of JavaScript.
What should I know before learning new keyword?
Manning books that teach new keyword usually introduce this, object, function and arrow function first.
What is new keyword a kind of?
New keyword is a kind of keyword. A language-defined word or token with a predefined syntactic or semantic role, which may be restricted from use as an ordinary identifier.
What is new keyword also called?
New keyword is also called new operator.
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.



