Hint
sort() mutates in place. Always spread first to avoid mutating the source.
const original = [3, 1, 2];
const sorted = [...original].sort();
console.log(original.join(','));
console.log(sorted.join(','));3,1,2 1,2,3
Explanation: [...original] creates an independent copy. sort() mutates sorted, not original.
Key Insight: sort() mutates in place. Always spread first to avoid mutating the source.