var numbers = [3, 10, 9 , 6]; function compareNums(a, b){ return a - b; } numbers.sort(compareNums); console.log(numbers); // outputs [3, 6, 9, 10]