Guest User

Untitled

a guest
May 24th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. var car = function(make, model, year, color) {
  2. this.make = make;
  3. this.model = model;
  4. this.year = year;
  5. this.color = color;
  6.  
  7. this.getCarInfo = function() {
  8. var info = "Your car is a " + this.color + " " + this.make + " " + this.model + ", year " + this.year;
  9. return info;
  10. };
  11. };
  12.  
  13. var car1 = new car("Toyota", "Camry", 2014, "Barcelona Red");
  14. var car2 = new car("Dodge", "Ram", 2006, "White");
  15.  
  16. console.log(car1.getCarInfo());
  17. console.log(car2.getCarInfo());
Add Comment
Please, Sign In to add comment