The $(document).ready() method only waits for the DOM to load, it doesn't wait for stylesheets, images, and iframes. The DOMContentLoaded event fires once the DOM has loaded, so you'll only see "Hello World!" in the console after the method has started running.
Table of contents
How to Use the $(document).ready() Method in jQueryHow to Use the DOMContentLoaded Event in JavaScriptSummarySort: