I would like to structure my app like this:
APP.open = (function ($) {
return {
people: function() {
return {
gender: function() {},
age: function() {}
}
}
};
}(jQuery));
I can get APP.open.people(), but when I do: APP.open.people.gender(); I get undefined.
APP.open.people().gender();APP.opena function? Just asking, because I'm not really an expert on javascript.APP.openis an object, as the function you see is an IIFE that executes immediately and returns an object.APP.open.peopleon the other hand, is not an IIFE, and has to be called.