Skip to content

Instantly share code, notes, and snippets.

@sampathsl
Created December 13, 2015 13:34
Show Gist options
  • Save sampathsl/dc7580c39dd7513d2a41 to your computer and use it in GitHub Desktop.
Save sampathsl/dc7580c39dd7513d2a41 to your computer and use it in GitHub Desktop.
ES6 Class Support
class Vehicle {
constructor(){
this.type = 'Vehicle';
}
getBrand(val){
console.log('Type: ' + val + ', This is a ' + this.type);
}
}
class Car extends Vehicle{
constructor(){
super();
this.type = 'Car';
}
}
let vehicle = new Vehicle();
vehicle.getBrand('Toyota');
let car = new Car();
car.getBrand('BMW');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment