2 Answers
2

1) jQuery's .ready handler loads when the DOM is ready. This means it will fire before some other things are loaded like images.

Generally when running javascript you only care about the DOM being ready.

2) runs when the entire document is loaded. This is ok if you don't have jQuery on the page and loading of images is not going to slow you down noticeably.

3) This is just a function declaration. It is not in build. The browser does not run it for you.

The entire point of using $(document).ready(f); is to ensure that you do not manipulate the DOM with javascript before it is ready. If your very unlucky you can corrupt the DOM. If your less unlucky your selectors do not work as expected because the elements are not in the DOM when you run the javascript code.