<script> var myModel=(function(){ var model={}; var privateVar="Hello World"; function privateMethod() { privateVar="Hello World!!"; }; model.publicVar="Aven"; model.publicMethod=function() { privateMethod(); console.log(privateVar); }; return model; })(); myModel.publicMethod(); </script>
(function() { var myQuery=(function() { var _myQuery={}; _myQuery.queryElementById=function(id) { console.log('QueryElementById:'+id); }; return _myQuery; })(); window.myQuery=window._=myQuery; })(); _.queryElementById('#qryBtn');