sorting an array of integers in javascript