Javascript is actually a great language. Its garbage-collected closures made it easy to do GUI programming.
The C/C++ world where browsers came from didn't have this (closures). So it is actually a miracle we got a language as (relatively) great as Javascript.
Each to their own I guess, by personally I really don't like closures (at least ones that as per their namesake, close over objects with nontrivial lifetimes).
I think it was the right call by the C++ people to explicitly list what objects are captured and how, even if the syntax's not the best.
RAII is a fact of life unfortunately, not just in C++ or Rust, but if you talk over some high level protocol over the internet you go TCP socket->HTTP connection->your stream protocol; and have to do the exact reverse.
Closures break RAII hard.
Incidentally, you don't even need closures for nice looking UI code. Immediate mode GUIs like Dear Imgui or Clay allow for super-simple looking code in basic C
loading story #50626666
It was a missed opportunity for a mature language like Scheme which had at the time all the good parts, none of the bad parts and the only issue was slightly unfamiliar syntax.
loading story #50626542
loading story #50626651
I really like closures, except when you need to debug them because the callstack looks like the leaning tower of Piza.
> garbage-collected closures
A feature existed since 1960s...