title: Double negation (!!) in JavaScript - what is the purpose?
body: <blockquote>
  <p><strong>Possible Duplicate:</strong> <br />
  <a href="https://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 I couldn't help to wonder why the double negation? And is there an alternative way to achieve the same effect?</p>
  <p>(The code is from <a href="https://github.com/eriwen/javascript-stacktrace/blob/master/stacktrace.js." rel="nofollow noreferrer">https://github.com/eriwen/javascript-stacktrace/blob/master/stacktrace.js.</a>)</p>