Thanks, @Stan`, that helped me solve it. In case anyone else runs into this:
Most of the errors were cause by a folder called ~/.local/share/0ad/mods/techtree.
I found if I completely deleted the folder called ~/.local/share/0ad/mods then it was rebuilt when the game would start up again, and this time with zero javascript errors.