algorithms/palindromes.js

9 lines
237 B
JavaScript
Raw Permalink Normal View History

2024-01-12 07:01:06 -05:00
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"));