To get around the "serve a webpage locally" problem, you could either have Python or Node serve a webpage, or I once rigged up a samba share and a small web server on a home server and turned a kid loose on it ... It didn't take, I should have spent more time helping them daily on it.
I’ll second p5.js and the coding train video series. They are quite good, fun and more advanced than than the videos make them out to be.
P5 also has an online dev environment which is good enough. If you create an account you can save stuff online (make sure to backup, another good lesson).
New ones are infrequent but there is a fairly complete set on the web.
Ive also started playing with
https://phaser.io/. It’s more of a game framework in JavaScript with built in libraries for collision. The getting started tutorial is decent/short and gives a good idea of what is going on.
P5 is definitely what I'd recommend to a lot of people for actually starting to learn to code although I think in coding a game it might fall down the second you want to do collisions as you're going to have to roll all that yourself from scratch.
In 2024 I'd be tempted to say if you want to make games it might even be better to just get started with Unity, Unreal or Godot and YouTube tutorials + AI help might be enough to smooth it out enough.
The absolute basic stuff might be trickier than a system where it's quite easy to draw on a screen in a few lines but the stuff of collisions and beyond are way easier.
For collisions I can say p5.play has been an excellent plugin for p5 to handle inertial physics and collisions.
I would suggest that the novice game developer might enjoy rolling their own basic collision detection ( object overlay, mouse-over, inertia-ignoring collision resolution, etc), but obviously that is not fun or convenient for everyone.
Basic 60 frames a second canvas and the rest is JavaScript.
Pair that with the excellent Coding Train series https://youtube.com/@thecodingtrain
To get around the "serve a webpage locally" problem, you could either have Python or Node serve a webpage, or I once rigged up a samba share and a small web server on a home server and turned a kid loose on it ... It didn't take, I should have spent more time helping them daily on it.
But that's an idea.