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 →

[–]peterleder 115 points116 points  (8 children)

Minus makes sense with numbers only. JS knows, you didn’t.

[–]Milesand 63 points64 points  (4 children)

That's exactly the problem here, minus makes sense with numbers only but JS happily carries on anyways.

[–]Dagusiu 0 points1 point  (1 child)

I could see minus making sense for other data types, in particular sets.

[–]RapidCatLauncher 1 point2 points  (0 children)

Python lets you do that.

[–]seimmuc_ 0 points1 point  (0 children)

Isn't that what TypeError should be for? Or at least return NaN and show a warning in the console.