algorithms/palindromes.js
2024-01-12 07:01:06 -05:00

8 lines
237 B
JavaScript

function palindrome(str) {
const upper = str.toUpperCase();
const letters = upper.match(/[A-Z0-9]/g);
if (letters.toString() === letters.reverse().toString()) return true;
else return false;
}
console.log(palindrome("e_ye 3"));