Summary: Getting Classy

Review what we learned about classes in JavaScript.

We'll cover the following

Key points

  • Objects are copied by reference in JavaScript. To make a hard copy of an object, you need to use the spread operator.

  • Object-oriented programming (OOP) is a programming concept that involves keeping code in objects.

  • Encapsulation means that the inner workings of an object are kept away from the users.

  • Polymorphism means that objects can share the same methods, but implement them in different ways.

  • Inheritance means that a class can inherit all the properties and methods from a parent class and then add their own, more specific properties and methods, or change some of the properties and methods from those of the parent class.

  • We can create classes in JavaScript using the class keyword. The class describes the properties and methods that each instance of that class will have.

  • The constructor function defined in the class is called whenever a new instance of a class is created using the new keyword.

    After the quiz and challenge, we’ll be learning about how to code with time and dates.

Get hands-on with 1200+ tech skills courses.