Possible Duplicate:
What is the !! (not not) operator in JavaScript?
I have encountered this piece of 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;
}
And I couldn't help to wonder why the double negation? And is there an alternative way to achieve the same effect?
(The code is from https://github.com/eriwen/javascript-stacktrace/blob/master/stacktrace.js.)