I already know about the advantages of wrapping your Javascript in a function like this:
(function () {
// code goes here
}())
But I've seen some scripts which accomplish this by passing the wrapper function to the jQuery object:
$(function () {
// blah blah blah blah blah
});
What's the advantage of doing it this way, or is it just a matter of personal taste? And does doing it the second way negate the need for $(document).ready()
?