Advertisement
Guest User

Untitled

a guest
Sep 10th, 2013
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var bla = (function() {
  2.  
  3.     function priv() {
  4.         return 2;
  5.     }
  6.  
  7.     // Public methods
  8.     return {
  9.         pub: function() {
  10.             return priv();
  11.         }
  12.     }
  13. })();
  14.  
  15. function Bla1() {
  16.     priv = function() {
  17.         return 2;
  18.     }
  19.  
  20.     // Public methods
  21.     this.pub = function () {
  22.         return priv();
  23.     }
  24. }
  25.  
  26. var bla2 = {
  27.     _priv: function() {
  28.         return 2;
  29.     },
  30.  
  31.     pub: function() {
  32.         return this._priv();
  33.     }
  34. };
  35.  
  36. // Main gate
  37. (function() {
  38.     console.log(bla2.pub());
  39. })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement