The problem is not Javascript itself IMO, the problem is that there exists a large portion of web-only developers with knowledge only about Javascript, who try to cram it down every corner and every problem space that they can. This leads to things like Electron polluting a space where Qt/wxwidgets/win32/GTK would be technically superior by producing small and native binaries, yet we get steaming messes of Chromium that swallow hundreds of megabytes of RAM and waste millions of CPU cycles.
In 2021, nobody likes programming efficiently in native languages anymore it seems.
That's not the problem. I did GUI programming for a decade before switching to web.
The reason that people write GUI apps in Electron instead of Qt/Gtk is because the latter is so far behind technologically that it feels like ancient technology. Electron has GPU-accelerated, declarative graphics in CSS, it has React, it has the web inspector, it has a scripting language with an extremely good JIT.
Qt/Gtk has not adapted to the state of the art, it has stayed static while the world has moved on. It's now 20 years out of date. That is why people use Electron.
Non-uniform non-platform-widget based rendering of applications is not something I would call state-of-the-art. The overton window has only shifted to that recently. I would claim that a small statically linked executable displaying a native window containing native widgets is state-of-the-art, and would blow everything ever created in webland out of the water instantly in terms of resource usage and performance.
Since you named it explicitly - why would my application want a web inspector or CSS layouting overhead if the goal is to display a small batch of controls? This is exactly the mindset I meant when I wrote my post.
Qt has GPU-accelerated graphics with the QtQuick scene grqph since 2014. Qml is a declarative language and quite easy to learn with Js based property bindings. It also has an inspector with Gammaray and many profilers (e.g. hotspot,heaptrack, qt creator profilers, kcachegrind, massif,...). The real reason why people are not using it more is the licensing LGPL3 is a bit too scary for some people and the commercial license to expensive
Red Hat and other Gnome-/GTK-adjacent people were on the JS bandwagon well before Electron was a thing. Most Electron developers have never actually made a good faith effort to try out JS development using GTK. How many Electron developers even know that when they interact with a vanilla Ubuntu desktop, they are using a window manager and desktop environment written in JS? I'd be skeptical that it was anywhere north of 15%.
If GTK had received a fraction of the attention and misdirected enthusiasm that went into bolstering the NodeJS ecosystem, things would be very different.
In 2021, nobody likes programming efficiently in native languages anymore it seems.