add method to a class js code example
Example 1: javascript create class
class Car {
constructor(brand) {
this.carname = brand;
}
}
Example 2: javascript classes
let Person = class {
constructor(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
}