How to get a javascript function to execute only once on dom ready
<p>I'm getting alerted "hi" over and over again, how do I get it to do it once and stop:</p>

<pre><code>function doSomething() {
   alert('hi');
}

$(function() {
    doSomething();
});
</code></pre>
