Js minor fixes

Run jshint through the files and fixed the little standing issues. Remove global variables used in for loops, some unnecessary semicolons and fixed a typo in the name of a variable.