What's the difference between
var myView = function () {
//something goes here
};
and
var myView = function () {
//something goes here
return {
a: x,
b: y
}();
I think the first snippet creates a "dynamic" class, so that you can say
var anotherView = new myView();
and the second snippet is similar to a singleton "dynamic" object, but I'm not very sure.