remove function from loop

See http://jsperf.com/inner-closures
Update index.js
Merge pull request #3 from Nami-Doc/patch-1

remove inner closure from loop