Js Sort Number Array Javascript Iteration