A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-74.ts
1constt:readonlynumber[]=[1,2,3];
2constsorted=[...t].sort((a,b)=>b-a);
3console.log(sorted[0],t[0]);
Modern
Answer & explanation
Console output
3 1
Why
Array.sort mutates in place, which is why you cannot call it on a readonly array directly. Spreading first yields a mutable copy; sorting it descending puts 3 first, while the original t keeps its order, so t[0] is still 1.