This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.
Smartphone icons created by Freepik - Flaticon
When using a setter to set a property value, you do not use parantheses.
class Car { constructor(brand) { this._carname = brand; } set carname(x) { this._carname = x; } get carname() { return this._carname; } } const myCar = new Car("Ford"); myCar.carname = "Volvo"; document.getElementById("demo").innerHTML = myCar.carname;