What are the differences between these two types of namespace declarations? Is the first one better than the second one or vice versa?
(function($)
{
$.build = {
init: function()
{
this.attachEvents();
}
}
}
$(document).ready(function() {
$.build.init();
});
})(jQuery);
versus
var build = {
init: function(){
this.attachEvents();
}
};
$(document).ready(function() {
build.init();
});