var arr=[]; for(var i=0;i<10;i++){ var res=Math.floor(Math.random()*(100-10))+10; arr.push(res); } arr.sort(); console.log(arr);