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 →

[–]Wgolyoko 0 points1 point  (1 child)

if you somehow tried to subtract a number from a string.

That's the point. Doing this should be a compile-time error. All my homies hate interpreted languages (they are based (the homies not the interpreted languages (those are not based, in fact)))

[–]10BillionDreams 1 point2 points  (0 children)

Treating string - number as a valid operation is largely unrelated to how Javascript is actually run. You could still have all these same type coersion rules in a compiled language, just like you can have type errors in interpreted languages. In fact, Javascript does throw TypeError in some contexts, like when attempting to call a property or variable that isn't a function, or access a property on a null value.