Let's say we have some code that is used to initialize things when a page is loaded and it looks like this:
function initStuff() { ...}
...
$(document).ready(initStuff);
The initStuff function is only called from the third line of the snippet. Never again. So usually people put this into an anonymous callback like this:
$(document).ready(function() {
//Body of initStuff
});
Having the function in a dedicated location in the code is not really helping with readability, because with the call on ready() makes it obvious that this is initialization code.
Are there any other reasons to prefer one over the other?