Guest User

Untitled

a guest
Jul 16th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. var MyApp = {};
  2.  
  3. MyApp.MyModule = function(arg1) {
  4. //Private methods
  5. var methodOne = function() {};
  6. var methodTwo = function() {};
  7.  
  8. return (function() {
  9. var self = {};
  10.  
  11. self.init = function() {
  12. console.log('hoistable/before: ' + hoistable); //returns undefined
  13. hoistable = arg1;
  14. console.log('hoistable/after: ' + hoistable); //returns value of arg1
  15. };
  16.  
  17. return self;
  18. })();
  19.  
  20. //Private variables
  21. var hoistable, anotherVar, yetAnother;
  22. }
Add Comment
Please, Sign In to add comment