Loading…

What is class and how to use class in Javascript?

A class is a type of function in Javascript. It can be declared with the class keyword. We can use these function expression syntax to initialize a function and class expression syntax to initialize a class in Javascript.

Example

                                        

function PrintString(name1, name2, name3) {
    alert(name1 + name2 + name3);
}

 

const result = new PrintString(1, 2, 3);

Suggest An Answer

No suggestions avaliable!

Latest post from Front end Developer Interview Questions

Ask Question