I've picked up a project and all the js files are written as modules like below and then concatenated into one minified file.
Is there any benefits to writing the js files like this? For example on the project its not using multiple 'Footer' objects so surely theres no need to abstract it and should just do self invoking functions?
function Footer(){
var $elements = {
slideButton : $('.js-footer-slide-btn'),
slideBlock : $('.js-footer-slide-block')
};
this.initialise = function(){
$elements.slideButton.click(function(){
$(this).toggleClass('active').next().stop().slideToggle();
});
};
}
var footer = new Footer();
footer.initialise();