Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 212 Bytes

constructors.md

File metadata and controls

13 lines (10 loc) · 212 Bytes

Constructors

Way of defining objects before classes were introduced in ES16

function Car(id){
  this.carId = id
  this.start = _ => `start ${this.carId}`
}

let car = new Car(5)
car.start()