Advertisement
sanjiisan

Untitled

May 13th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. var teacher = {
  2. name: 'Janusz',
  3. surname: 'Serek',
  4. teach: function (test) {
  5. return test;
  6. },
  7. getName: function () {
  8. return 'cześć: ' + this.name;
  9. }
  10. };
  11.  
  12. teacher.sound = 'Hau';
  13.  
  14. teacher.daj_glos = function () {
  15. return this.sound;
  16. };
  17.  
  18. console.log(teacher);
  19. console.log(teacher.daj_glos());//odwolanie od właściwości
  20. // console.log(teacher.teach(64));//odwolanie od właściwości
  21.  
  22.  
  23. // ///////////////
  24.  
  25. var Car = function (hp, type, color) {
  26. this.hp = hp;
  27. this.type = type;
  28. this.color = color;
  29. this.km = 0;
  30. };
  31.  
  32. var mercedes = new Car(5050, 'W124', 'Dark Green');
  33. var golfMk4 = new Car(1500, 'Comfort', 'Dark Green');
  34.  
  35. Car.prototype.drive = function (km, asqwe, ytr) {
  36. console.log('Jade', km, asqwe, ytr);
  37. };
  38.  
  39. console.log(mercedes.drive(15));
  40. console.log(golfMk4.drive(15));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement