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

Course Content

Object-Oriented Programming in JavaScript

Object-Oriented Programming in JavaScript

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

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:

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

Task

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

Task

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

Everything was clear?

Section 1. Chapter 2
toggle bottom row

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:

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

Task

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

Task

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

Everything was clear?

Section 1. Chapter 2
toggle bottom row

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:

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

Task

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

Task

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

Everything was clear?

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:

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

Task

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

Section 1. Chapter 2
Switch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt