Hacker News new | past | comments | ask | show | jobs | submit login

Accepting NaN as a number can potentially crash your app, that's why I reject it in isNumber.

I only tried to highlight some edge cases that I personally don't like to spend energy on, trying to get it right, when writing code. Btw, isNumber is a dynamic call in the example and unrelated to TypeScript. TypeScript doesn't exist at runtime.




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

Search: