What I Hate About Your Programming Language
Subject:   JavaScript
Date:   2004-08-16 18:38:40
From:   wickline_ora
Well, maybe you don't hate JavaScript for this, but I sure do...

The decision to use '+' for both addition and concatenation was very unfortunate. JavaScript is often used to validate/manipulate HTML form element values. Those values are not typed... they're just the value in the form.

If you '+' two form values (or a form value and something else) should you be interpreted as concatenating or adding?

Far too often, I've had to do foo.value*1 to enforce numeric interpretation and therefor addition instead of concatenation.

The same applies to using the same comparison operators for both numeric and string comparison.

Would it have killed them to add a separate concatenation operator and a few string comparison operators?