JavaScript Algorithms and Data Structures Projects - Palindrome Checker

Tell us what’s happening:
Describe your issue in detail here.
where am I not getting correctly

  **Your code so far**
function palindrome(str) {
let onlyLetters = str.replace(/[`~!@#$%^&*()_|+\-=?;:",.<>\{\}\[\]\\\/]/gi, '');
onlyLetters.toLowerCase().split("");
for (let i = 0; i < onlyLetters.length - 1 / 2; i++) {
  if (onlyLetters[i] !== onlyLetters[onlyLetters.length - i - 1]) {
    return false;
    break;

  }
}
return true;
}


// TEST CASES

palindrome("eye");
//should return true.

palindrome("_
  **Your browser information:**

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

Challenge: JavaScript Algorithms and Data Structures Projects - Palindrome Checker

Link to the challenge:

What is the purpose of this line?

thanks
i got to remove it.

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