pass functions as a parameter in JavaScript
<p>How do I pass functions as a parameter in JavaScript.</p>

<p>In the code below if I call <code>whatMustHappen (TWO(),ONE())</code> I want to them to fall in the sequence of the <code>x</code> and the <code>y</code> on the <code>whatMustHappen</code> function.</p>

<p>Right now it fires as it sees it in the parameter.</p>

<pre><code>var ONE = function() {
    alert("ONE");
}
var TWO = function() {
    alert("TWO");
}
var THREE = function() {
    alert("THREE");
}
var whatMustHappen = function(x, y) {
    y;
    x;
}
whatMustHappen(TWO(), null);
whatMustHappen(TWO(), ONE());
</code></pre>
