Skip to content

Instantly share code, notes, and snippets.

@vinhnx
Created September 15, 2012 04:56
Show Gist options
  • Save vinhnx/3726382 to your computer and use it in GitHub Desktop.
Save vinhnx/3726382 to your computer and use it in GitHub Desktop.
function Car(listedPrice) {
var price = listedPrice;
this.speed = 0;
this.numWheels = 4;
this.getPrice = function() {
return price;
};
}
Car.prototype.accelerate = function() {
this.speed += 10;
};
function ElectricCar( listedPrice ) {
// add an 'electricity' property to this class
var price = listedPrice;
}
ElectricCar.prototype = new Car();
// Add refuel method here:
ElectricCar.prototype.refuel = function( ) {
};
myElectricCar = new ElectricCar(500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment