Huh? I can't say about "most", but most that I am aware of or used, no.
Also, even if that was true. That's still very error-prone thing, even if everyone else does it. While I don't agree that JS is really bad language overall, this shit is bad.
I mean, I've only done Ruby and C# in my professional life, but they both do it and I know from school that Java does it and I think python does too? I don't know, those could be outliers and be the only ones who does this.
I don’t think any of the languages you’ve named do this to the same extent as JavaScript. I could be wrong, but if I recall correctly Java and C# will coerce to a string if you’re concatenating, but will still throw an error if you’re passing to a function that expects a string (like this case in JavaScript). I don’t think Python implicitly coerces anywhere (outside of functions like print and explicit string interpolation). I’m not sure about Ruby, but I think it only coerces certain string-like types in certain contexts.
Old JavaScript would coerce everywhere imaginable because it really didn’t want to throw errors.
The languages that maybe do similar with I can think of are Perl and Php.
View all comments
Show parent comment
1
u/Eva-Rosalene Mar 21 '24
Huh? I can't say about "most", but most that I am aware of or used, no.
Also, even if that was true. That's still very error-prone thing, even if everyone else does it. While I don't agree that JS is really bad language overall, this shit is bad.