The javascript code I'm refactoring for work often declares functions as variables and then defines them in a $().ready
block.
To be clear, this is what the code is like:
var myFunction;
$().ready(function(){
myFunction = function() {
//function body
}
});
What are the advantages of this practice with respect to a normal function declaration and definition? Are there any or is it just a syntactic difference? I searched through other questions and didn't seem to find anything.