Comments by "George Helyar" (@georgehelyar) on "Why Does Everyone HATE JavaScript? (Yet Still Use It?)" video.
-
9
-
4
-
2
-
Every time I have to use JavaScript it surprises me with something simple that it can't do.
For example string replace only replaces the first occurrence, which is not obvious, and replaceAll was only added in ES 2021. Before that you could do it with regex, but you had to know that you had to do this in the first place.
Equality is also all over the place. I think Fireship has a video with some good examples of this.
Type checking with typeof and string comparison, followed by a bunch of checking for properties is crazy.
Anything can be thrown, and there is no way to filter a catch block, so you need to have catch blocks that can deal with anything, without throwing themselves.
The 'this' keyword is also quite error prone, and you also have to know that arrow functions treat 'this' differently to normal functions, so they are not just interchangeable syntactic sugar.
The built in base64 encoding exists but is broken, so you need to use a package to do it safely.
IIFEs are a smelly solution to a problem that should never have existed, although they are less necessary now.
It's got a lot better in recent years but it's still got a long way to go.
At some point wasm might be good enough to offer some actual choice in web development languages, and then there will be some competition from things like rust, but right now the only reason to use JS (or something that transpiles to JS) is because it's pretty much the only choice for web development.
2