define a common variable for two ethoda in class javascript code example
Example 1: javascript create class
class Car {
constructor(brand) {
this.carname = brand;
}
}
Example 2: variables in js class
constructor(){
this.foo = bar
}
class Car {
constructor(brand) {
this.carname = brand;
}
}
constructor(){
this.foo = bar
}