+!! operator in an if statement

后端 未结 6 2016
旧巷少年郎
旧巷少年郎 2020-12-29 18:31

I was reviewing the code for an angularjs factory to better understand how it works. The code contains an if statement that I don\'t fully understand.

I

6条回答
  •  旧时难觅i
    2020-12-29 19:02

    Meanwhile, ^ is the bitwise XOR operator.

    When dealing with numbers smaller than 2, ^ will work like a boolean OR (||) if you consider 0 = false and 1 = true.

提交回复
热议问题