The use of the triple exclamation mark

前端 未结 5 828
眼角桃花
眼角桃花 2020-12-01 05:52

Looking through the source code of one of our projects, I\'ve found some amount of places where we\'re using three exclamation marks in conditional statements, like so:

5条回答
  •  北海茫月
    2020-12-01 06:35

    There is no difference between !a and !!!a, since !!!a is just !!(!a) and because !a is a boolean, !!(!a) is just its double negation, therefore the same.

提交回复
热议问题