-2

Such as if(!!you) , I thought we can get rid of the !! , and it's the same. Cause JavaScript will change it to Boolean automatically?

  • duplicate http://stackoverflow.com/questions/784929/what-is-the-not-not-operator-in-javascript http://stackoverflow.com/questions/9284664/double-exclamation-points – hallie Jul 15 '15 at 01:15

1 Answers1

0

!! cast the variable to a Boolean. Similar to how you do +foo to cast it to a number.

Derek 朕會功夫
  • 92,235
  • 44
  • 185
  • 247