for each element in array javascript