I am wondering is step 1 necessary if you can ignore case with -i with .match?
so step 2 would actually read → .match(/[a-z0-9]/gi);
This is the walkthrough code:
function palindrome(str) {
const alphanumericOnly = str
// 1) Lowercase the input
.toLowerCase()
// 2) Strip out non-alphanumeric characters
.match(/[a-z0-9]/g);
// 3) return string === reversedString
return alphanumericOnly.join('') ===
alphanumericOnly.reverse().join('');
}
function palindrome(str) {
return true;
}
palindrome("eye");
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36
Challenge: Palindrome Checker
Link to the challenge: