-1

I'm wondering how JavaScript evaluates the following expression:

10.333333 | 0 === 10

Is it because of bitwise ORing ignores the decimal part?

Amr M. AbdulRahman
  • 1,671
  • 3
  • 13
  • 22

1 Answers1

3

JavaScript bitwise operators all work by converting their operands to 32-bit integers. The operation is performed and the result is converted back to a (floating point) number.

Pointy
  • 389,373
  • 58
  • 564
  • 602