var angka = [2, 7, 3, 1, 2, 8, 17, 10]; angka.sort(function(x,y) { return x-y; }); console.log(angka);