OOP summary

Here's a quick table summarizing the concepts discussed so far:

Feature

Illustrates concept

Bob is a man (an object).

Objects

Bob's date of birth is June 1, 1980, gender: male, and hair: black.

Properties

Bob can eat, sleep, drink, dream, talk, and calculate his own age.

Methods

Bob is an instance of the Programmer class.

Class (in classical OOP)

Bob is based on another object, called Programmer.

Prototype

(in prototypal OOP)

Bob holds data (such as birth_date) and methods that work with the data (such as calculateAge()).

Encapsulation

You don't need to know how the calculation method works internally. The object might have some private data, such as the number of days in February in a leap year. You don't know, nor ...

Get Object-Oriented JavaScript - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.