Build a Palindrome Checker Project - Build a Palindrome Checker

Tell us what’s happening:

As far as I can tell, I should have a working project, but it seems like when I click to run the tests, the HTML isn’t connected to the JS page. I think I did it right, and it seemed to work until I hit “Save your Code” and now it doesn’t work anymore.

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="styles.css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  </head>
  <body>
    <input id="text-input"></input>
    <button id="check-btn" onclick="checkPalindrome()">Check</button>
    <div id="result"></div>
  </body>
  <script src="./script.js"></script>
  </html>
/* file: script.js */
function checkPalindrome(){
  const inputText = document.getElementById("text-input").value;
  if(inputText === ""){
    alert("Please input a value")
  };
  const result = document.getElementById("result");
  const inputArr = inputText.toLowerCase().split("").filter((c) => !c.match(/[\(\)\\.\s_,-()]/gi));

  for(let i=0; i<inputArr.length; i++){
    if(inputArr[i] !== inputArr[inputArr.length - i - 1]){
    result.innerArr = `${inputArr} is not a palindrome`
    return
    };
  }
result.innerArr =  `${inputArr} is a palindrome`
}
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36

Challenge Information:

Build a Palindrome Checker Project - Build a Palindrome Checker

Welcome to the forum :wave:

Do you get any errors?

Welcome to the forum @Amiloo

Do you see any message in the console?

Happy coding

Thank you. It did return some errors, and I found a few bonehead typos, then updated the alphanumeric symbol checker thing.

Are you still getting an error?

I get this error with your code:

SyntaxError: invalid range in character class

Please let us know any errors you are getting and what you think they might be related to.