javascript array map function with index