What is === in javascript?
The operator ~
returns that result:
~N = -(N+1)
But this is an effect of inverting the value of all bits of a variable.
Double tilde ~~
is used to convert some types to int, since ~
operator converts the value to a 32-bit int before inverting its bits. Thus:
~~'-1' = -1
~~true = 1
~~false = 0
~~5.6 = 5