let numbers = [0, 1 , 2, 3, 10, 20, 30 ]; numbers.sort( function( a , b){ if(a > b) return 1; if(a < b) return -1; return 0; }); console.log(numbers); Code language: JavaScript (javascript)