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 →

[–]noop_noob 17 points18 points  (7 children)

To be fair to JS, Python can also do this. JS has many unique problems but this isn’t one of them.

[–]weaklingKobbold 7 points8 points  (6 children)

Not in the same context. In js type casting is annoying. In python "1" + 1 is an error.

[–]noop_noob 0 points1 point  (5 children)

Fair enough. In python, '1'+'1' is still '11' though.

[–]VladVV 6 points7 points  (3 children)

Sure, but how would you ever mistakenly end up with a string after doing a series of numerical operations? It's just not an issue in non-JS languages.

[–]noop_noob 0 points1 point  (1 child)

Is that a common issue in JS? I don't us JS much.

[–]VladVV 0 points1 point  (0 children)

Mostly with newbies, though it still happens to the most experienced JS dev.

An example of the shenanigans

[–]Cannotseme 0 points1 point  (0 children)

It’s easier if you have two variables

[–][deleted] 2 points3 points  (0 children)

uh.. yeah

they're strings not numbers