WIP: review and fix js variable declarations and scoping, indentations, syntax
Review all js files (i.e., all js files within js, migrations, test directories) to ensure all variables are properly declared and scoped, so as not to crowd the global namespace. Also, fix indentations, spacing, semi-colon insertions, for clarity and readability.
Edited by dju