Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Class Attributes | Classes & Objects
Object-Oriented Programming in JavaScript
course content

Kursinhalt

Object-Oriented Programming in JavaScript

Object-Oriented Programming in JavaScript

1. Classes & Objects
2. Encapsulation
3. Static
4. Inheritance

book
Class Attributes

Attributes are some variables inside the class that describe each object. Let’s demonstrate it with two classes – Rectangle and Student.

We can represent Rectangle by its height and width. Add these Attributes to the class definition:

1234
class Rectangle{ height; width; }
copy

If you need to describe student in some way, you can create class Student with attributes like, for example, name and university.

1234
class Student{ name; university; }
copy
Aufgabe

Swipe to start coding

Add more attributes to the class Student: age and gpa variables.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 2
toggle bottom row

book
Class Attributes

Attributes are some variables inside the class that describe each object. Let’s demonstrate it with two classes – Rectangle and Student.

We can represent Rectangle by its height and width. Add these Attributes to the class definition:

1234
class Rectangle{ height; width; }
copy

If you need to describe student in some way, you can create class Student with attributes like, for example, name and university.

1234
class Student{ name; university; }
copy
Aufgabe

Swipe to start coding

Add more attributes to the class Student: age and gpa variables.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 2
Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
We're sorry to hear that something went wrong. What happened?
some-alt