Code is not working for palindrome checker

i had completed my project code for a palindrome checker. after running tests its not completing the tests. i don’t know why this is happening.
please help me in this regard
here’s my code

const checkBtn = document.getElementById("check-btn")
const userInput = document.getElementById("text-input")
const result = document.getElementById("result")
const checkPalindrome = str => {
  const ival = str;
    if(str === "") {
        alert("Please input a value");
   const lowerCaseStr = str.replace(/[^A-Za-z0-9]/gi, '').toLowerCase();
   let resultMsg = `<strong>${ival}</strong> ${lowerCaseStr === [...lowerCaseStr].reverse().join('') ? 'is a ' : 'is not a '} Palindrome`;
   result.innerHTML = resultMsg 

   checkBtn.addEventListener("click", ()=>{
 userInput.value = ''
  } ) 
  userInput.addEventListener('keydown' , e =>{
      if(e.key === 'Enter'){
          userInput.value = ''

Could you share the HTML as well? It’s required to fully reproduce the working state.

yes sure!

<input id="text-input">
<button id="check-btn" onClick="isPalindrome()">Check</button>
<div id="result"></div>

It doesn’t have the script tag, to use the code defined in JS file.

thanks for the response

i have added it in the separate js file but it is also not working there as well. test is going fails.

Did you add the script tag to your HTML?

It helps if you share your entire, updated HTML.

Thanks for guidence problem solved .