Hacker News .hnnew | past | comments | ask | show | jobs | submitlogin

> If you know a few tricks, like how to let the VM know you want integer math [1]

> [1] Add | 0 after every math operation to get a 32-bit signed integer result, and >>> 0 for a 32-bit unsigned integer result.

That's definitely gonna cause a few "wtf?" moments for everyone else on your team, lol



Yeah, you shouldn't do it all over the place prophylactically. It's a technique for optimizing functions that are performance critical. Although I find `| 0` surprisingly well known these days. I sometimes use it in places where I want a cast to integer.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: