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

Accumulating loop results in an array is bad for perf, but won't necessarily cause logic bugs.

My favourite implicit return gotcha comes from the intersection of CoffeeScript and jQuery, where implicitly returning `false` from an event handler implies `preventDefault()` and `stopPropagation()`. This can even cause heisenbugs if your logging throws booleans around.



Another bad one: returning a jQuery.ajax object, and then consumers of your api may start using it directly.

We have that in our codebase still. Not sure if it was intentional or not but it's going to be hard to undo.




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

Search: