I've just come accross this code and wondered what the benefit is of storing the properties that they are actually using inside a function.
var FormEditable = function() {
return{
init: function() {
console.log('test');
}
}
}();
jQuery(document).ready(function() {
FormEditable.init()
});
As opposed to...
var FormEditable = function() {
return{
init: function() {
console.log('test');
}
}
};
jQuery(document).ready(function() {
FormEditable().init()
});
or...
var FormEditable = {
init: function() {
console.log('test');
}
};
jQuery(document).ready(function() {
FormEditable.init()
});
The last example is what I am probably more familiar with seeing. All three work I just wondered why go for the first?