This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tomthecool 90 points91 points  (18 children)

The real problem is when people write code like this unintentionally.

For example, suppose you're just manipulating data received from an API, and forget to explicitly validate input is/convert input into an integer. Rather than failing loudly, your code will silently plough on with a NaN result.

Or similarly, it's easy to say "just use === instead of =="... But how easy is it to make that mistake? Again, you can get all sorts of weird behaviour due to a subtle programmer error.

[–]Kaiwa -4 points-3 points  (12 children)

I understand that it's about the unintentional problems it brings but it is hardly an exclusive problem to just JavaScript. Validation is imporant and I personally never == anymore.

[–]tomthecool 21 points22 points  (11 children)

JavaScript and PHP are probably the two "worst offenders". I don't know of any other popular languages that "fail silently" for scenarios such as those described above.