I've been seeing this pattern in various projects I learn from, sometimes when using jQuery developers wrap their code in this function:
jQuery(function ($) {
'use strict';
/* Application code */
}($)); /* End jQuery */
I was trying to look up the explanation in jQuery docs, but didn't really find much. Could you please explain to me why and when should this be used? And are there better practices / alternatives for something like this.