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

And every time a developer sees that, they're going to google "bar javascript" "single bar javascript" "bitwise or javascript" "bitwise or javascript effect" until they figure out WTF is going on.

This all to save a fraction of a microsecond on an operation that's called 60 times on the page.



Actually only 52 :D

But yeah, I agree about googling part: I remember having Googled "tilde javascript" and "pipe javascript".. :)

Tilde is useful with indexOf:

if (~array.indexOf(item)) {}

..equals to:

if (array.indexOf(item) > -1) {}


This is the sort of thing that makes Perl readable in comparison to Javascript :)




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

Search: