Skip to content

Instantly share code, notes, and snippets.

@lylijincheng
Created August 19, 2013 03:54
Show Gist options
  • Save lylijincheng/6265638 to your computer and use it in GitHub Desktop.
Save lylijincheng/6265638 to your computer and use it in GitHub Desktop.
ES5 oo sample.
// ES6 class
Class Vehicle {
constructor(color) {
this.color = color;
this.speed = 0;
}
drive() {
this.speed = 40;
}
}
// ES6 inherit
class Car extends Vehicle {
constructor(brand, color) {
super(color);
this.brand = brand;
this.wheels = 4;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment