Introduction
Most developers associate object-oriented programming with languages that are typically taught in school, like C++ and Java, which base object-oriented programming around classes. Before you can do anything in these languages, you need to create a class, even if you’re just writing a simple command-line program.
Common design patterns in the industry reinforce class-based concepts as well. But JavaScript doesn’t use classes, and this is part of the reason people get confused when they try learning it after C++ or Java.
Object-oriented languages have several characteristics:
Encapsulation. Data can be grouped together with functionality that operates on that data. This, quite simply, is the definition of an object.
Aggregation. One object ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access