liveBook · Manning

Prototype-based object orientation

As explained in Secrets of the JavaScript Ninja, Second Edition

An object-oriented model in which objects inherit properties through prototype links rather than class inheritance.

JavaScript uses prototypes rather than class-based object orientation. Developers who carry class-based expectations into JavaScript may be surprised when their code behaves differently. section 1.1

Objects and prototypes are closely related in JavaScript. Understanding that relationship provides a foundation for JavaScript application development across web, desktop, mobile, and server environments. section 1.1

How Secrets of the JavaScript Ninja, Second Edition covers it

How deep it goes
Contrasts prototypes with class inheritance and signals deeper coverage of their operation and implementation, but gives no mechanics here.
Examples
Uses Java-trained developers who write class-based code in JavaScript and are surprised by the results.
What you can do after
Understand that JavaScript uses prototypes rather than class-based object orientation.
How it connects
Connects prototypes with objects and contrasts prototype-based object orientation with class-based object orientation.

Also explained in

Compare how 2 books explain prototype-based object orientation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secrets of the JavaScript Ninja, Second Edition. The section links point to the parts of the book it draws on.