max number in array javascript for loop