This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.



Smartphone icons created by Freepik - Flaticon

JS Classes

Creating two car objects from a car class:

class Car {
  constructor(name, year) {
    this.name = name;
    this.year = year;
  }
}

const myCar1 = new Car("Ford", 2014);
const myCar2 = new Car("Audi", 2019);

document.getElementById("demo").innerHTML =
myCar1.name + " " + myCar2.name;