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

Зміст курсу

Object-Oriented Programming in JavaScript

Object-Oriented Programming in JavaScript

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

bookClasses

Hi there! Let's start learning OOP with the JavaScript programming language. Hope you are familiar with JavaScript syntax and can write simple programs. The next step is understanding OOP or Object Oriented Programming. OOP is a programming paradigm with the idea of a specific program organization. It is about creating objects that contain some data and methods. Each object is an instance of some class.

Class definition

You already know about primitive data types like string, number, bool, null, undefined, symbol. In JavaScript, you also can create user-defined data types - the classes. Class is a way how the user can define and represent some data and the behavior for this data.

Let's start with a simple class Circle with no data for now:

123
class Circle { // body of the class }
copy

This class has only a name now. Later, it will contain and describe some data about the circles and can be used, for example, for some geometry application.

For simplicity and clarity, in this course we will follow this way of creating a class, but let's take a look at a bit different ways.

JavaScript feature

There are some other ways to define a class in JS. We can define a class and create some objects at the same time, like this:

1
const firstCircle = class Circle {/* body of the class*/ };
copy

Or define object secondCircle of the class without name, like this:

1
const secondCircle = class{/* body of the class*/ };
copy

Завдання

Create empty class with name Rectangle.

Since each class represents some specific independent data type, it should contain attributes and methods. Let's go to the next chapter.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 1
toggle bottom row

bookClasses

Hi there! Let's start learning OOP with the JavaScript programming language. Hope you are familiar with JavaScript syntax and can write simple programs. The next step is understanding OOP or Object Oriented Programming. OOP is a programming paradigm with the idea of a specific program organization. It is about creating objects that contain some data and methods. Each object is an instance of some class.

Class definition

You already know about primitive data types like string, number, bool, null, undefined, symbol. In JavaScript, you also can create user-defined data types - the classes. Class is a way how the user can define and represent some data and the behavior for this data.

Let's start with a simple class Circle with no data for now:

123
class Circle { // body of the class }
copy

This class has only a name now. Later, it will contain and describe some data about the circles and can be used, for example, for some geometry application.

For simplicity and clarity, in this course we will follow this way of creating a class, but let's take a look at a bit different ways.

JavaScript feature

There are some other ways to define a class in JS. We can define a class and create some objects at the same time, like this:

1
const firstCircle = class Circle {/* body of the class*/ };
copy

Or define object secondCircle of the class without name, like this:

1
const secondCircle = class{/* body of the class*/ };
copy

Завдання

Create empty class with name Rectangle.

Since each class represents some specific independent data type, it should contain attributes and methods. Let's go to the next chapter.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 1
toggle bottom row

bookClasses

Hi there! Let's start learning OOP with the JavaScript programming language. Hope you are familiar with JavaScript syntax and can write simple programs. The next step is understanding OOP or Object Oriented Programming. OOP is a programming paradigm with the idea of a specific program organization. It is about creating objects that contain some data and methods. Each object is an instance of some class.

Class definition

You already know about primitive data types like string, number, bool, null, undefined, symbol. In JavaScript, you also can create user-defined data types - the classes. Class is a way how the user can define and represent some data and the behavior for this data.

Let's start with a simple class Circle with no data for now:

123
class Circle { // body of the class }
copy

This class has only a name now. Later, it will contain and describe some data about the circles and can be used, for example, for some geometry application.

For simplicity and clarity, in this course we will follow this way of creating a class, but let's take a look at a bit different ways.

JavaScript feature

There are some other ways to define a class in JS. We can define a class and create some objects at the same time, like this:

1
const firstCircle = class Circle {/* body of the class*/ };
copy

Or define object secondCircle of the class without name, like this:

1
const secondCircle = class{/* body of the class*/ };
copy

Завдання

Create empty class with name Rectangle.

Since each class represents some specific independent data type, it should contain attributes and methods. Let's go to the next chapter.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Hi there! Let's start learning OOP with the JavaScript programming language. Hope you are familiar with JavaScript syntax and can write simple programs. The next step is understanding OOP or Object Oriented Programming. OOP is a programming paradigm with the idea of a specific program organization. It is about creating objects that contain some data and methods. Each object is an instance of some class.

Class definition

You already know about primitive data types like string, number, bool, null, undefined, symbol. In JavaScript, you also can create user-defined data types - the classes. Class is a way how the user can define and represent some data and the behavior for this data.

Let's start with a simple class Circle with no data for now:

123
class Circle { // body of the class }
copy

This class has only a name now. Later, it will contain and describe some data about the circles and can be used, for example, for some geometry application.

For simplicity and clarity, in this course we will follow this way of creating a class, but let's take a look at a bit different ways.

JavaScript feature

There are some other ways to define a class in JS. We can define a class and create some objects at the same time, like this:

1
const firstCircle = class Circle {/* body of the class*/ };
copy

Or define object secondCircle of the class without name, like this:

1
const secondCircle = class{/* body of the class*/ };
copy

Завдання

Create empty class with name Rectangle.

Since each class represents some specific independent data type, it should contain attributes and methods. Let's go to the next chapter.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 1
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
some-alt