Array.prototype.toReversedintermediateconst original = [1, 2, 3]
const reversed = original.toReversed()
original // β [1, 2, 3] (unchanged)
reversed // β [3, 2, 1]Unlike reverse(), toReversed() leaves the original array untouched.
A key feature of toReversed() is that it leaves the original array unchanged. This makes it safe to use in functional or reactive contexts where mutation is undesirable.
Challenge: Implement checkImmutable(arr) that calls arr.toReversed() but returns the original array unchanged.
checkImmutable([1, 2, 3]) // β [1, 2, 3] (original order preserved)