Tell us what’s happening:
Maybe I’ve just been staring at this too long, but I don’t understand why this wont pass.
Your code so far
<!-- file: index.html -->
<input id='text-input'></input>
<button id='check-btn'></button>
<div id='result'></div>
/* file: styles.css */
/* file: script.js */
const input = document.getElementById("text-input");
const button = document.getElementById("check-btn");
const result = document.getElementById("result")
const str = input.value.replace(/[\W_]/g, "");
const lowerd = str.toLowerCase()
const rev = lowerd.split("").reverse().join("")
const checkForPalindrome = () => {
if(lowerd === rev){
result.innerText=`${input.value} is a palindrome`
}else{
result.innerText=`${input.value} is not a palindrome`
}
};
button.addEventListener("click", checkForPalindrome);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0
Challenge Information:
Build a Palindrome Checker Project - Build a Palindrome Checker