There are lots of places where the Javascript code uses var when it should be using let (or const?)
Is there any reason to keep the var type for local variables? I think it would make it easier to find errors if variables were scoped as tightly as possible. Also for const to be used where possible. Sebb
