In javascript, how can I find out if a string starts with the word "Error"?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/646628/javascript-startswith">Javascript StartsWith</a>  </p>
</blockquote>



<p>I have a string like this:</p>

<pre><code>var a = "xxx";  or
var a = "Error";
</code></pre>

<p>Is there a way I can find out with an if statement if the string starts with "Error" ?</p>
