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 Circle
with no data for now:
class Circle { // body of the class }
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:
const firstCircle = class Circle {/* body of the class*/ };
Or define object secondCircle
of the class without name, like this:
const secondCircle = 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 Circle
with no data for now:
class Circle { // body of the class }
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:
const firstCircle = class Circle {/* body of the class*/ };
Or define object secondCircle
of the class without name, like this:
const secondCircle = 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 Circle
with no data for now:
class Circle { // body of the class }
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:
const firstCircle = class Circle {/* body of the class*/ };
Or define object secondCircle
of the class without name, like this:
const secondCircle = 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 Circle
with no data for now:
class Circle { // body of the class }
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:
const firstCircle = class Circle {/* body of the class*/ };
Or define object secondCircle
of the class without name, like this:
const secondCircle = 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.