title: Vanilla JavaScript equivalent of jQuery's $.ready() - how to call a function when the page/DOM is ready for it
body: <p>With jQuery, we all know the wonderful <code>.ready()</code> function:</p>
  
  <pre><code>$('document').ready(function(){});
  </code></pre>
  
  <p>However, let's say I want to run a function that is written in standard JavaScript with no library backing it, and that I want to launch a function as soon as the page is ready to handle it. What's the proper way to approach this?</p>
  
  <p>I know I can do:</p>
  
  <pre class="lang-js prettyprint-override"><code>window.onload="myFunction()";
  </code></pre>
  
  <p>Or I can use the <code>body</code> tag:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;body onload="myFunction()"&gt;
  </code></pre>
  
  <p>Or I can even try at the bottom of the page after everything, but the end <code>body</code> or <code>html</code> tag like:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;script type="text/javascript"&gt;
      myFunction();
  &lt;/script&gt;
  </code></pre>
  
  <p>What is a cross-browser(old/new)-compliant method of issuing one or more functions in a manner like jQuery's <code>$.ready()</code>?</p>