JS: Array.prototype.toReversed
(new in JS: ECMAScript 2023)
same as JS: Array.prototype.reverse but return a copy.
const xx = [3, 4, 5]; const yy = xx.toReversed(); console.log(xx); // [ 3, 4, 5 ] console.log(yy); // [ 5, 4, 3 ]
(new in JS: ECMAScript 2023)
same as JS: Array.prototype.reverse but return a copy.
const xx = [3, 4, 5]; const yy = xx.toReversed(); console.log(xx); // [ 3, 4, 5 ] console.log(yy); // [ 5, 4, 3 ]