liveBook · Manning

Prototype

A JavaScript prototype is an object through which other objects can access properties and methods by delegation during lookup.

How 5 Manning books explain it

The Joy of JavaScript

In JavaScript object creation, the prototype is an object that serves as the shared delegate from which other objects can inherit properties and methods.

How it is used
Uses prototypes to share properties and methods across linked JavaScript objects without duplicating them.
How deep it goes
Works through Object.create, property lookup, differential inheritance, and constructor-chain configuration; explicitly defers detailed treatment of property shadowing.
Examples
Models linked transaction objects, shared hash-calculation methods, and constructor-based transaction hierarchies.
What you can do after
Build it from scratch with Object.create or constructor prototypes, and diagnose missing methods by checking prototype-chain links.

Read how The Joy of JavaScript explains prototype →

Secrets of the JavaScript Ninja, Third Edition

A prototype is an object from which another JavaScript object can inherit properties and methods.

How it is used
Explains how JavaScript objects inherit properties and why class instances can use methods they do not own.
How deep it goes
Works through chained property lookup, runtime prototype assignment, constructor linkage, and class methods; does not descend into engine implementation.
Examples
Uses a three-object chain, a constructor with a prototype method, and a class whose instances inherit a method.
What you can do after
Diagnose/debug with it by tracing inherited property access and checking whether a class method belongs to an instance or its prototype.

Read how Secrets of the JavaScript Ninja, Third Edition explains prototype →

Secrets of the JavaScript Ninja, Second Edition

An object from which another object can inherit properties in JavaScript.

How it is used
Organizes reusable object properties and methods through delegated lookup and inheritance.
How deep it goes
Works through prototype-chain lookup, constructor-created links, and runtime changes; does not describe engine-level lookup internals.
Examples
Uses linked objects with property checks, a constructor-provided method, and prototypes changed after instantiation.
What you can do after
Build it from scratch by linking objects or assigning shared methods to a constructor's prototype, and predict which instances see later changes.

Read how Secrets of the JavaScript Ninja, Second Edition explains prototype →

JavaScript in Depth

An object-linked reference target from which another object can inherit properties through delegation in JavaScript.

How it is used
Explains delegated property access, shared behavior, shadowing, prototype inspection, and constructor-based object creation.
How deep it goes
Traces [[Prototype]] lookup, shadowing, accessors, inspection APIs, and new's four operations, while stopping short of runtime optimization internals.
Examples
Uses shared drawer objects, shadowed labels, accessor properties, prototype inspection, and a simulated new implementation.
What you can do after
Diagnose prototype-chain behavior with Object.create(), Object.getPrototypeOf(), in, Object.hasOwn(), and an explicit model of new.

Read how JavaScript in Depth explains prototype →

Essential TypeScript 5, Third Edition

The prototype system is JavaScript's object-inheritance mechanism in which objects delegate property and method lookup to prototype objects.

How it is used
Explains how JavaScript objects share inherited behavior and how that behavior underlies classes.
How deep it goes
Works through lookup, shared-prototype changes, custom chains, constructors, shadowing, and type checks using code examples.
Examples
Uses hat and boots objects, product constructors, taxed products, and index.js listings to trace shared methods and inheritance.
What you can do after
Build it from scratch with custom or constructor prototypes, and diagnose inherited-method lookup with prototype checks.

Read how Essential TypeScript 5, Third Edition explains prototype →

Also covered in

What to know first

Related concepts

Questions about prototype

What is prototype?

A JavaScript prototype is an object through which other objects can access properties and methods by delegation during lookup.

Which Manning books explain prototype?

The Joy of JavaScript, Secrets of the JavaScript Ninja, Third Edition, Secrets of the JavaScript Ninja, Second Edition, JavaScript in Depth and Essential TypeScript 5, Third Edition.

What should I know before learning prototype?

Manning books that teach prototype usually introduce function, object, object literal and prototype chain first.

What is prototype part of?

Prototype is part of prototype chain. A prototype chain is the linked sequence of JavaScript prototype objects consulted during property lookup when an object lacks the requested property itself.

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.