I was researching on jQuery best practices and found this article by Greg Franko
Normally, I do:
$(\"document\").ready(function() {
// The DOM i
It's called a self ivoking
or immediately invoked
function.
It means that the function is run as soon as it is created using the parameters in the final set of brackets.
Read Javascript Self Invoking Functions and Immediately-Invoked Function Expression (IIFE) will clear where to use and how to use these functions