Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Vehicle() {
  2.     this.speed = 20;
  3. }
  4.  
  5. Vehicle.prototype.isFasterThan = function(other) {
  6.     return this.speed > other.speed;
  7. };
  8.  
  9. function Car() {
  10.     Vehicle.call(this);
  11.     this.color = 'red';
  12. }
  13.  
  14. Car.prototype = Object.create(Vehicle.prototype);
  15.  
  16. Car.prototype.drive = function(speed) {
  17.     this.speed = speed;
  18. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement