Update index.js

Used jslint to rearrange the code.