Update index.js

Moving var declaration