I have a variable that stores false or true, but I need 0 or 1 instead, respectively. How can I do this?
false
true
0
1
I just came across this shortcut today.
~~(true)
~~(false)
People much smarter than I can explain:
http://james.padolsey.com/javascript/double-bitwise-not/