Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The issue is that it's a JS only syntax trick. Things like x || y, or even !!x work in most languages, so would be readable to someone who has never used JS before and is trying to read your code base. ~~x would be int32(x) or int(x) in most other languages, so it's not going to be something that's universally learned.

Also, there are multiple ways to convert to int (~~ is equivalent to truncate). Why leave it ambiguous instead of using Math.trunc / Math.floor / Math.ceil?



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

Search: