Javascript examples for Object:Module
Using modular pattern to create a module
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w.ja v a 2 s .c o m var module_pattern = (function() { var private = 'private'; var a = function() { console.log('private variable is ' + private);}; var b = function() {}; return {a: a }; })(); module_pattern.a(); } </script> </head> <body> </body> </html>