Yeah, there are a few ways to do it. I was using num >> 0 before but ~~n is more concise and makes a little more sense (imo) like doing a double negation !!
Engines that support asmjs use |0 as a backwards compatible type annotation. It means "this value is a 32 bit integer". It is not the same as Math.floor, although with some values it will behave like it.
6
u/Skhmt Mar 19 '19
asm.js uses
anyNumber|0to do the same thing