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

nested ternaries are the same as if-else-if continuations. You figure that out one time, and it's easy to parse forever after.

The ternary operator in general eases understanding because it extracts the common bit, i.e. "sides[i] =", meaning you don't have to carefully read the contents of each and every conditional block to verify nothing else is going on besides this one assignment.



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

Search: