let arr = [...new Array(10)].map(item => {
return Math.ceil(Math.random() * 1000)
})
function sort(arr) {
let tempArr = [...arr];
for (let i = 0; i < tempArr.length - 1; i++) {
for (let j = 0; j < tempArr.length - 1 - i; j++) {
if (tempArr[j] > tempArr[j + 1]) {
let temp = tempArr[j]
tempArr[j] = tempArr[j + 1]
tempArr[j + 1] = temp
}
}
}
return tempArr
}
console.log(sort(arr))