Array.prototype.reverseadvancedconst arr = [1, 2, 3]
arr.join('') === [...arr].reverse().join('')
// β false (not a palindrome)Compare an array with its reverse to check for palindromes without mutating the original.
An array is a palindrome if it reads the same forwards and backwards: [1, 2, 1] is a palindrome, [1, 2, 3] is not.
Compare each element with its mirror index to check efficiently.
arr.every((val, i) => val === arr[arr.length - 1 - i])