DEV Community

Discussion on: Is JavaScript the most confusing programming language?

Collapse
 
jwkicklighter profile image
Jordan Kicklighter

To be fair, the first few examples don't line up specifically because the old language feature was not obvious and new languages features were added to correct this (e.g. variable scoping with let vs var). Also, the arrow function vs normal function are explicitly different because it's actually useful to have both. Sometimes you want to stay in the current scope, sometimes you want an isolated scope.

There are many things JS does weird, but several of these examples are attempts to correct things. With the variable example, it's very recommended to just not use var ever and just use const or let. But var must be kept around for compatibility.

That said, TS is absolutely trying to make things even better and helping remove a full class of errors that compiled language devs haven't had to think about for decades.