Btw just adding to the ~~x tip, bitwise operators only work with 32-bit numbers, so if you have a number that could be greater than 2147483647, you'll likely get inaccurate results, and should use Math.floor.
Also an alternative to ~~x is also x | 0 (or 0 | x, x << 0, etc.)
Caleb
Code.
Nice article! π
Btw just adding to the
~~xtip, bitwise operators only work with 32-bit numbers, so if you have a number that could be greater than 2147483647, you'll likely get inaccurate results, and should use Math.floor.Also an alternative to
~~xis alsox | 0(or0 | x,x << 0, etc.)