Creating Classes

In this chapter, we will cover the following recipes:

  • Creating a new class
  • Assigning properties with constructor arguments
  • Defining methods on a class
  • Checking the instance type with instanceOf
  • Using getters to create read-only properties
  • Using setters to encapsulate values
  • Using static methods to work with all instances

Get ECMAScript Cookbook 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.