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

Since NaN != NaN you could also do (a === b) || ((a != a) && (b != b))


I don't know why you'd use a != a instead of isNaN(a). The former hides what you're doing. Though treating two NaN values as equal doesn't even make sense in the first place.




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

Search: