Guest User

Untitled

a guest
Oct 11th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. var Foo = function (a)
  2. {
  3. this.a = a
  4. }
  5. Foo.prototype =
  6. {
  7. helloFoo: function ()
  8. {
  9. console.log('Foo: a =', this.a)
  10. }
  11. }
  12.  
  13. var Bar = function (a, b)
  14. {
  15. Foo.call(this, a)
  16. this.b = b
  17. }
  18. Bar.prototype = $.extend(
  19. {
  20. helloBar: function ()
  21. {
  22. console.log('Bar: a =', this.a, ', b =', this.b)
  23. }
  24. }, Foo)
  25.  
  26. var bar = new Bar(23, 'skidoo')
  27. bar.helloFoo()
  28. bar.helloBar()
  29.  
  30. // Foo: a = 23
  31. // Bar: a = 23 , b = skidoo
Add Comment
Please, Sign In to add comment