Your files never leave your device
Advertisement

Classes & OOP

Classes are blueprints for creating objects with shared properties and methods. They introduce Object-Oriented Programming to JS.

Creating a Class

The constructor method runs when a new instance is created via the new keyword.

Try It Yourself

        

Inheritance

Classes can extend other classes to inherit their methods.

Try It Yourself

        

Practice

Challenge 1: Create a Car class with make and model, and a drive() method.

Related Guides

Sponsored Utility
While You're Here
Sponsored Recommendations
Advertisement