Javascript – Classes

Javascript introduced classes in ES6 (ECMAScript2015). To define a class you need to use the class keyword and add a constructor method which is executed when a new object is created. You must declare a class before you use it.

You can create new objects from this class using the new keyword

In classes, the functions are defined only with their name, without the function keyword

Static methods

Static methods are created using the static keyword. They can be used without an object creation.

You do not need to create an object to call a static method.

getters and setters

You use getters and setters if you want to do something special with the value before you set them or return them. You declare them using the get and set keywords.

the source code

Javascript – Classes

Read More

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s