Q1: How can I load the myApp object from inside the anonymous function into the DOM ready function. I know one way to pass the object is using the window.myApp = myApp; inside the anonymous function but this exposes the myApp Object as a global object.
$(function(){
//Load myApp inside here
});
(function(){
var myApp = {
//with properties inside
}
}());
Q2:Also, I've seen the following brackets inside and brackets outside. What do they do?
(function(){
var myApp = {
//with properties inside
}
}(brackets inside))(brackets outside);
Q3: I know its not possible but is there a hack/trick to load the anonymous function after DOM loads?