Immutable Array Methods: toSorted, toReversed, toSpliced and with
sort() , reverse() and splice() change the original array. That causes subtle bugs, especially with React state, where you must not mutate. ES2023 added non-mutating versions. The old trap const scores = [30, 10, 20]; const ranked = scores.sort((a, b) => b - a...