Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Vehicle() {
- this.speed = 20;
- }
- Vehicle.prototype.isFasterThan = function(other) {
- return this.speed > other.speed;
- };
- function Car() {
- Vehicle.call(this);
- this.color = 'red';
- }
- Car.prototype = Object.create(Vehicle.prototype);
- Car.prototype.drive = function(speed) {
- this.speed = speed;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement