1

I have a question on how this operator works here:

var x = 808 / 60 | 0; // Will return 13
var y = 808 / 60; // Will return 13.466666666666667

Why adding a bitwise OR operator ( | ) here return me a integer?

2
  • 1
    because it casts 64 bit float to 32 bit int for the bitwise operation (and then back). Commented Jul 11, 2018 at 7:18
  • I'm reading the other threads, ty Commented Jul 11, 2018 at 7:22

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.