Double negation (!!) in javascript - what is the purpose?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/784929/what-is-the-not-not-operator-in-javascript">What is the !! (not not) operator in JavaScript?</a>  </p>
</blockquote>



<p>I have encountered this piece of code </p>

<pre><code>function printStackTrace(options) {
    options = options || {guess: true};
    var ex = options.e || null, guess = !!options.guess;
    var p = new printStackTrace.implementation(), result = p.run(ex);
    return (guess) ? p.guessAnonymousFunctions(result) : result;
}
</code></pre>

<p>And couldn't help to wonder why the double negation? And is there an alternative way to achieve the same effect?</p>

<p>(code is from <a href="https://github.com/eriwen/javascript-stacktrace/blob/master/stacktrace.js">https://github.com/eriwen/javascript-stacktrace/blob/master/stacktrace.js</a>)</p>
