es6-class:

When You New a Class in JavaScript?

Here is an example of instantiating a class using the new operator: class Person { constructor(name, age) { this.name = name; this.age = age; } } const asian = new Person('Alice', 25); console.log(asian); As you can see from below, asian is not a class, it is instead, an object: [object Object] { age: 25, name: "Alice" } The values of asian are set by the constructor of the Person class.

by lek tin in "javascript" access_time 1-min read