JavaScript Algorithms and Data Structures Projects - Palindrome Checker

Tell us what’s happening:
Describe your issue in detail here.
I don’t understand why it says “str.split() is not a function”
Your code so far

function palindrome(str) {
  
  // \W means non-alphanumeric characters

  // reverse the string by built-in functions

  // also turn everything into lower or uppercase

  str = str.replace(/\W/gi, "").toLowerCase;
  let reversedStr = str.split("").reverse().join("");
  console.log(str);

// use if statement to check the string

  if (str = reversedStr) {
    return true;
  } else {
    return false;
  }
  
}
palindrome("eye");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36

Challenge: JavaScript Algorithms and Data Structures Projects - Palindrome Checker

Link to the challenge:

You’re really missing the parentheses on your lower case function. That will take care of that error

1 Like

alright thank you so much

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.