Introduction to JavaScript Object-Oriented Programming

JavaScript·2 min read·Jan 1, 2026

In JavaScript, object-oriented programming (OOP) is a programming paradigm centered around the concept of classes, which serve as templates for creating objects.

Classes are used to define the structure and behavior of the objects created from them called instances, specifying fields (properties) to hold data and methods (functions) to operate on that data.

Overall, they allow developers to create reusable, modular code that models real-world entities and their relationships.

Learning objectives

In this module, you'll learn how to define and instantiate classes, how to design objects with clear responsibilities, and how to extend behavior through inheritance.

You'll also learn how runtime errors fit into object-oriented code: how to throw them, re-throw them, and let them bubble up when a component cannot recover. This will become essential later when you start writing CLI tools and APIs that must fail predictably.

After completing this module, you will be able to:

  • Define classes that model real-world entities with fields and methods.
  • Instantiate objects from classes and work with their state.
  • Use public, private, and static fields and methods appropriately.
  • Use inheritance to extend an existing class without duplicating code.
  • Design getters and setters to expose computed properties and validate assignments.
  • Throw, re-throw, and propagate runtime errors intentionally.
  • Build complete scripts that rely on interacting instances instead of loose variables.