Contenido del Curso
Object-Oriented Programming in JavaScript
Object-Oriented Programming in JavaScript
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:
class Student { // body of the class }
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:
const firstStudent = class Student {/* body of the class*/ };
Or define object secondStudent
of the class without name, like this:
const secondStudent = class{/* body of the class*/ };
Tarea
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.
¡Gracias por tus comentarios!
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:
class Student { // body of the class }
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:
const firstStudent = class Student {/* body of the class*/ };
Or define object secondStudent
of the class without name, like this:
const secondStudent = class{/* body of the class*/ };
Tarea
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.
¡Gracias por tus comentarios!
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:
class Student { // body of the class }
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:
const firstStudent = class Student {/* body of the class*/ };
Or define object secondStudent
of the class without name, like this:
const secondStudent = class{/* body of the class*/ };
Tarea
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.
¡Gracias por tus comentarios!
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:
class Student { // body of the class }
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:
const firstStudent = class Student {/* body of the class*/ };
Or define object secondStudent
of the class without name, like this:
const secondStudent = class{/* body of the class*/ };
Tarea
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.