DEV Community

Discussion on: Generating Random Whole numbers in JavaScript in a specific range

Collapse
 
codingjlu profile image
codingjlu

>> and | also work in flooring a number, but in negative values it rounds "down".

Thread Thread
 
jonrandy profile image
Jon Randy πŸŽ–οΈ

It isn't flooring in these cases - merely removing the decimal part.

Thread Thread
 
codingjlu profile image
codingjlu

Oh, I forgot to mentionβ€”it behaves just like Math.floor unless the value is negative.