For Each Loop Javascript Array Sort