let sorted = [].concat(arr).sort(function(a, b) {
return a - b;
})
// You need to copy the array before you sort it.
// One way with es6:
const sorted = [...arr].sort();
// or use slice() without arguments
const sorted = arr.slice().sort();