Im building an app's namespace and it looks as follows:
var app = {};
app.utils = {
Expiration: function(){ // contructor
... // some code
},
init: (function(){
app.utils.Expiration.prototype = function(){....}
())
};
But i get an error: TypeError: Cannot read property 'Expiration' of undefined, and actually it's true beacuse utils is still being defined, i know that i can define the prototype outside of the scope of app, my question is: can i define it inside app or app.utils with an self executing function or by any other means, thanks.
utildefinition?app.utilsis not properly defined until AFTER that entire declaration is done.