javascript for of current index