Quotes help make search much faster. Example: "Practice Makes Perfect"

Thursday, December 6, 2012

Codecademy: Codeyear Inheritance Review


//sample solution


function Car( listedPrice ) {
   var price = listedPrice;
   this.speed = 0;
   this.numWheels = 4;
 
   this.getPrice = function() {
       return price;
   };
}

Car.prototype.accelerate = function() {
   this.speed += 10;
};

// Write ElectricCar class here

ElectricCar.prototype = new Car(listedPrice);

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts