Possible Duplicate:
What is the !! operator in JavaScript?
What is the difference between these two operators? Does !! have special meaning, or does it simply mean you are doing two ‘!’ operations. I know there are “Truth” and “Truthy” concepts in Javascript, but I’m not sure if !! is meant for “Truth”
Writing
!!is a common way of converting a “truthy” or “falsey” variable into a genuine boolean value.For example:
After the first
!is applied tofoo, the value returned istrue. Notting that value again makes itfalse, meaning the code inside theifblock is not entered.