Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
class Car {
  constructor(make, model) {
    this._make = make
    this._model = model
  }
  get make() {
    return this._make
  }
  get model() {
    return this._model
  }
  set model(newModel) {
    this._model = newModel
  }
}
const myTesla = new Car("Telsa", "Model 3")
console.log(myTesla.make)
console.log(myTesla.model)
//change model of myTesla
myTesla.model = "Model X"
console.log(myTesla.model)
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x