Skip to content

Instantly share code, notes, and snippets.

@linuxsable
Created August 7, 2017 22:55
Show Gist options
  • Save linuxsable/d09e4cc1320a6dbc0941620507fea6c3 to your computer and use it in GitHub Desktop.
Save linuxsable/d09e4cc1320a6dbc0941620507fea6c3 to your computer and use it in GitHub Desktop.
function Vehicle() {
this.numTires = 4
}
Vehicle.prototype.start = () => {
console.log('engine starting!')
}
// const v = new Vehicle()
// v.start()
function Car() {
Vehicle.call(this)
}
Car.prototype = Object.create(Vehicle.prototype)
Car.prototype.rollDownWindows = () => {
console.log('rolling down windows')
console.log(this)
}
const c = new Car()
console.log(c.numTires)
c.start()
c.rollDownWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment