Use "^" to check if string begins with another string?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1767246/javascript-check-if-string-begins-with-something">javascript - check if string begins with something?</a>  </p>
</blockquote>



<p>I've read in <a href="http://stackoverflow.com/questions/1767246/javascript-check-if-string-begins-with-something">this post</a> that you can use ^= to check if a string begins with something.</p>

<p>I've fiddled with this example:</p>

<pre><code>var foo = "something-something";
if(foo ^= "something") {
    alert("works!");
}
else{
    alert("doesn't work :(");
}
</code></pre>

<p>And it doesn't work - does anyone how to do this?</p>

<p>jsfiddle example here: <a href="http://jsfiddle.net/timkl/M6dEM/" rel="nofollow">http://jsfiddle.net/timkl/M6dEM/</a></p>
