Tell us what’s happening:
hei i have been trying to to this eye is palindrom and _eye this all gives the correct answer but i dont understand why its not working on the test saying it has not passed
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Page Title</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<input id="text-input">
<button id="check-btn">check</button>
<div id="result"></div>
<script src="./script.js"></script>
</body>
</html>
/* file: styles.css */
/* file: script.js */
const textInput = document.getElementById("text-input");
const checkButton = document.getElementById("check-btn");
const result = document.getElementById("result");
checkButton.addEventListener("click", () =>{
const replaced = textInput.value.replace(/[^A-Za-z0-9]/g,"")
if (textInput.value === ""){
alert("Please input a value")
}else if(textInput.value.length === 1) {
result.innerText = `${textInput.value} is a palindrom`
}else if (replaced === [...replaced].reverse().join("")) {
result.innerText = `${textInput.value} is a palindrom`;
}else {
result.innerText = `${textInput.value} is not a palindrom`;
}
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Challenge Information:
Build a Palindrome Checker Project - Build a Palindrome Checker