This is kind of a half-baked excuse: but languages like C++ and Java require a couple of extra steps. There’s a build phase that turns your program into executable code. In the case of C++ you’ll need to compile it for each system you want to run it on, and with Java you’ll need a virtual machine running on the target device.
And for better or worse Microsoft and Apple are making it harder to run ’untrusted’ code, so sharing your creations with your friends could take some work.
With Javascript, as soon as you save your file you can reload your browser to run it (or see it not run) on any platform.
Sure, compiled languages will run faster and let you do more at once on the screen, but modern computers are generally ’fast enough’ for playing games in a browser.
Another thing that makes JavaScript an interesting language for making games is that browsers have fantastic debugging tools built right in. You can watch the gears of your game turning behind the scenes when you’re trying to figure out why your hero is inexplicably walking through walls and exploding.
JavaScript is a fun language to work with. The gratification when you make tweaks to graphics or code and hit ’refresh’ is nearly instantaneous.
My plan is to explain how I built Doctor Robot in 2012 while rebuilding it with modern (2024) JavaScript, and then build Dungeon the way I envisioned it.
The original-ish source code is up at https://github.com/jkersey/DoctorRobotJS.