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

IMO the behavior of "average" should be unspecified if it's passed anything but a single nonempty array of numbers. Making it even a tiny bit more robust is wasted work. Moreover, it's harmful because it encourages sloppy calling code.


The committee that designed SQL had a different opinion.


Right, that's a different philosophy. You can use JS as a dynamic language with DWIM qualities, like SQL. But I prefer to write JS code as if it were a typed language without nulls, and use tools to enforce that. I think that approach will win.




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

Search: