When I was first learning JavaScript, I sort of picked up the habit of wrapping any scripts I wanted to execute the moment the page loaded inside a construct like this:
$(function() {
//code
});
Having learned more since then, I'm under the impression I could just as easily toss the jQuery and write:
(function(){
//code
})();
Are these two methods equivalent in end result? Is one preferable? Am I entirely mistaken about one or both? What is the standard best practice for "execute on document ready"?