[Solved] What does the christmas-tree-Operator (>>~) do? [closed]


This line ends up getting a semicolon inserted after with ASI:

!0

Which is NOT 0 (a falsy value), which is true.

No ASI semicolon is inserted after the >> right shift and ~ bitwise NOT, so this is evaluated as one line:

0 >>~
!-0

Which can be (more correctly written) as:

0 >> ~!-0

Zero can only be right shifted to equal zero, but we’ll break down the right side anyways. Bitwise NOT, Boolean NOT, and numeric cast of 0.

-0 == 0
!0 == true
~true = -2

Again, it doesn’t matter what’s on the right side of the right shift, since zero is just a bunch of zero bits.

solved What does the christmas-tree-Operator (>>~) do? [closed]