Update index.js

I added the loop to change ' ' to '_'.