Classes in JavaScript

Spread & RestModule

Classes, introduced in ES6, provide a cleaner and more familiar syntax for creating objects and implementing inheritance. Under the hood, they are still based on prototypes, but the class syntax makes object-oriented programming more intuitive.

Classes are ideal for modeling real-world entities and organizing related data and behavior.

Class Declaration

Constructor and 'this'

The constructor method runs when you create an instance with new. 'this' refers to the new object.

Instance Methods

Inheritance with extends and super

Static Methods

Static methods belong to the class itself, not instances. Call them with ClassName.method().

Getters and Setters

Quick Quiz

Wir haben die Materialien überprüft, dennoch können Fehler vorkommen. Der Inhalt dient ausschließlich Bildungszwecken, daher verwende ihn auf eigene Verantwortung und überprüfe ihn bei Bedarf mit anderen Quellen.

✨ Frag Lara — deine KI-Lernpartnerin

Entsperre personalisierte Lernunterstützung. Lara kann Lektionen erklären, Themen zusammenfassen und deine Lernfragen beantworten — verfügbar ab dem Go-Tarif.


Lara hilft dir, schneller zu lernen — exklusiv für ReadyTools Go-, Plus- und Max-Mitglieder.

Verfolge deinen Fortschritt 🚀

Lerne einfacher, indem du deinen Fortschritt kostenlos verfolgst.