Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2013
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var object1 = function () {
  2.     return {
  3.         action1  : function () { console.log('action1'); },
  4.         action2  : function () { console.log('action2'); },
  5.         action3  : function () { console.log('action3'); }
  6.     };
  7. };
  8.  
  9. var object2 = function () {
  10.     var extend  = object1();
  11.         extend.action2 = function () {
  12.         console.log('actionNOTHING PLAYA!! Action2 got ownt!');
  13.         action4 : console.log('action4');
  14.     };
  15.    
  16.     return extend;
  17. };
  18.  
  19. //var display = object1();
  20. var display = object2();
  21. console.log(display);
  22. for (method in display) {
  23.     if (typeof display[method] === "function") {
  24.         display[method]();
  25.     };
  26. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement