JavaScript Classes
Overview
About this index
Classes are the modern way to write object-oriented JavaScript. Start with basics and constructor, then inheritance and privacy.
Index
Topics
| Topic | Summary |
|---|---|
class | declare a class, create instances with new, and add methods. |
constructor | initialize instance fields when new runs, call super in subclasses. |
extends | inherit from a parent class, override methods, and call super. |
static | methods and fields on the class itself, not on instances. |
#private | #name encapsulation, privacy from outside code. |
static {} | run setup code once when the class is defined. |
get / set | computed properties with get and set methods on classes. |
Frequently Asked Questions
Learn class for daily OOP, then read the prototype-chain guide to understand what class builds on.
CODETOFUN NEWS
Stay Ahead in Tech
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful
