-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,820
  • 3
  • 14
  • 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
  • 405,095
  • 59
  • 585
  • 614