Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function A() {}
  2. A.foo = "foo";
  3. A.prototype = {bar: function () { return "bar"; }};
  4.  
  5. function B() {}
  6. B.baz = "baz";
  7. B.prototype = new A();
  8. B.prototype.qux = function () { return "qux"; };
  9.  
  10. var b = new B();
  11. b.quo = "quo";
  12.  
  13. console.log(b.quo);    //-> "quo"
  14. console.log(b.qux());  //-> "qux"
  15. console.log(b.baz);    //-> undefined
  16. console.log(B.baz);    //-> "baz"
  17. console.log(b.bar());  //-> "bar"
  18. console.log(b.foo);    //-> undefined
  19. console.log(B.foo);    //-> undefined
  20. console.log(A.foo);    //-> "foo"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement