Guest User

Untitled

a guest
Jan 22nd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. // answer 1 - Functional
  2.  
  3. function Car (make, color){
  4. this.make = make;
  5. this.color = color;
  6.  
  7. this.logCar = function () {
  8. console.log("I'm a " + this.color +" "+ this.make);
  9. }
  10. }
  11.  
  12. // answer 2 - OO
  13.  
  14. function Car (make, color){
  15. this.make = make;
  16. this.color = color;
  17. }
  18.  
  19. Cars.prototype.logCar = function (){
  20. console.log("I'm a " + this.color +" "+ this.make);
  21. }
Add Comment
Please, Sign In to add comment