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

Conteúdo do Curso

Object-Oriented Programming in JavaScript

Object-Oriented Programming in JavaScript

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

Classes

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 Student with no data for now:

This class has only a name now. Later, it will contain and describe some data about the students and can be used, for example, for some web-site containing info about the university.

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:

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

Tarefa

Create empty class with name Rectangle.

Tarefa

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.

Tudo estava claro?

Seção 1. Capítulo 1
toggle bottom row

Classes

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 Student with no data for now:

This class has only a name now. Later, it will contain and describe some data about the students and can be used, for example, for some web-site containing info about the university.

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:

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

Tarefa

Create empty class with name Rectangle.

Tarefa

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.

Tudo estava claro?

Seção 1. Capítulo 1
toggle bottom row

Classes

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 Student with no data for now:

This class has only a name now. Later, it will contain and describe some data about the students and can be used, for example, for some web-site containing info about the university.

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:

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

Tarefa

Create empty class with name Rectangle.

Tarefa

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.

Tudo estava claro?

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 Student with no data for now:

This class has only a name now. Later, it will contain and describe some data about the students and can be used, for example, for some web-site containing info about the university.

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:

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

Tarefa

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.

Seção 1. Capítulo 1
Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt