Halting JavaScript program operation upon error condition?
<p>So in my app when a particular condition occurs, I want to display an alert and then stop program execution.  I read somewhere that this can be done with a throw() but I'm unable to make that work.</p>

<p>Here's what I've tried:</p>

<pre><code>function check_for_error(data) {
    try {
        if ( &lt;error condition&gt; ) { 
            throw "error"; 
        }
    } catch(e) {
            alert('error occured'); 
                // I want program execution to halt here but it does not, 
                // it continues within the calling code
    }
}
</code></pre>
