Improved js syntax

Removed , from last element of array
Added many missing semicolons
Some syntactical improvements
Fixed some errors with setTimeout

Change-Id: Ibaf7e2d52fba33910842bf0a4a0dfe4876b737c1
Merge "Improved js syntax"