how to create object in javascript with class code example
Example 1: how to create object in javascript with class
let myCar1 = new Car("Ford", 2014);
let myCar2 = new Car("Audi", 2019);
Example 2: how to create object in javascript with class
class Car {
constructor(name, year) {
this.name = name;
this.year = year;
}
}