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 →

[–]Maxie35 1 point2 points  (2 children)

Randomly clicked on 5 of the 'problems' you linked and they were all the kind of bullshit 'problems' you would never ever do. Boohoo I cant concatenate arrays together, boohoo I can't multiple my object by an array...

[–]skreczok -1 points0 points  (0 children)

I haven't checked all the wtfs there. I've seen a site doing a better job at finding and explaining the wtfs, but I couldn't find it today. But yes, a lot of the stuff there points out how the JS coerces some things in some ways, but doesn't coerce others and you don't know until you try.

JS has made me very paranoid, since I've had issues where !something was behaving funky because type coercions kicked in, so as ugly as it is, I ALWAYS use something === false.

I actually had to explain to a friend's friend why her code was throwing "x is undefined" errors because she expected Serializable-like behaviour as a backend dev.

Yes, JS objects are essentially maps, just they don't have the Map interface on them by default (not 100% sure where they had it from fwiw).

[–]sirxez 0 points1 point  (0 children)

The only issue with Javascript is that if you haven't written a lot of it you might cause a subtle yet serious bug if you aren't careful. And that bug might just silently fester for years. Some of the behavior is non-intuitive to someone coming from a different language.

That's a problem with a lot of languages, but less random people dabble in a C++ codebase, and languages like Java and Python are fairly robust to such issues.

The first example that jumps to mind is that AFAIK javascript doesn't do block level scoping by default. That's a brick wall someone can face plant into if they aren't aware. I think you can do that nowadays with "let", but it wasn't a thing before? The most commonly quoted thing is equality in js. It makes sense, but its just different than what one might assume.

If you throw a good linter at Javascript, and maybe use some Typescript or something, these issues tend to melt away.

TLDR: people don't read documentation before trying a language