Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save drinkmorewaters/57945c2ee0d2323b97d6516f3ab5a910 to your computer and use it in GitHub Desktop.
Save drinkmorewaters/57945c2ee0d2323b97d6516f3ab5a910 to your computer and use it in GitHub Desktop.
class Cars {
constructor(type, price, condition, color, location) {
this.type = type
this.price = price
this.condition = condition
this.color = color
this.location = location
}
sellCar(n) {
console.log(n.type, 'has been sold.')
return this
}
}
class Carz extends Cars {
named(n) {
console.log(n.type)
return this
}
}
let newCar = new Carz('Ford', 25000, 'Fair', 'Red', 'Sydney')
let cars = new Carz()
cars.named(newCar).sellCar(newCar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment