JSHint: Fix var statement and global scope issues.

Change-Id: Ia567d10b72f86963eb344cd5579738532531d3d9