Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function person(name, car) {
- this.name = name;
- this.car = car;
- function carName() {
- return car.model;
- }
- }
- var player = new person("Name", mustang);
- var bot = new person("Bot", mustang);
- var bot2 = new person("Bot 2", mustang);
- function makeCar(company, model, maxMPH, tireSize, zeroToSixty) {
- this.company = company;
- this.model = model;
- this.maxMPH = maxMPH;
- this.tireSize = tireSize;
- this.zeroToSixty = zeroToSixty;
- }
- var mustang = new makeCar("Ford", "Mustang GT", 105, 22, 8);
- var nissan = new makeCar("Nissan", "Nissan 360z", 100, 19, 6);
- var toyota = new makeCar("Toyota", "Toyota brandname", 95, 21, 7);
- console.log(player.name + " Is driving a " + player.carName());
- 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