(not using JavaScript, but still a great inspiration. There is another version: MicroBit and tablet, but I find the version with 2 micro:bits way more interesting.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Accidently came across this:
[2021] Running a Lego Compatible Train With Two (x2) Micro:bits
...on instructables, as well:
https://www.instructables.com/2021-Running-a-Lego-Compatible-Train-With-Two-x2-M/
(not using JavaScript, but still a great inspiration. There is another version: MicroBit and tablet, but I find the version with 2 micro:bits way more interesting.
1 Attachment