Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function person(name, car) {
  2.     this.name = name;
  3.     this.car = car;
  4.     function carName() {
  5.         return car.model;
  6.     }
  7. }
  8.  
  9. var player = new person("Name", mustang);
  10. var bot = new person("Bot", mustang);
  11. var bot2 = new person("Bot 2", mustang);
  12.  
  13. function makeCar(company, model, maxMPH, tireSize, zeroToSixty) {
  14.     this.company = company;
  15.     this.model = model;
  16.     this.maxMPH = maxMPH;
  17.     this.tireSize = tireSize;
  18.     this.zeroToSixty = zeroToSixty;
  19. }
  20.  
  21. var mustang = new makeCar("Ford", "Mustang GT", 105, 22, 8);
  22. var nissan = new makeCar("Nissan", "Nissan 360z", 100, 19, 6);
  23. var toyota = new makeCar("Toyota", "Toyota brandname", 95, 21, 7);
  24.  
  25. console.log(player.name + " Is driving a " + player.carName());
  26. console.log(mustang.company + " " + mustang.model + " which has a top speed of " + mustang.maxMPH + " with 0 - 60 being " + mustang.zeroToSixty + " seconds");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement