Okay here it says input is not defined. What did I wrong?
Thanks in advance!
const textInput = document.getElementById("text-input");
const checkBtn = document.getElementById("check-btn");
const result = document.getElementById("result");
//alert for no input
const checkForInput = (input) => {
if (input === ""){
alert("Please input a value");
}
}
checkBtn.addEventListener("click", () => {
checkForInput(textInput.value);
})
//Make everything lowercase
const lowercaseInput = input.replace(/[^A-Za-z0-9]/gi).toLowerCase();
//Check for palindrome and send message
const checkIfPalindrome = () => {
if (lowercaseInput === lowercaseInput.split("").reverse().join("")){
resultMessageTrue()
} else {
resultMessageFalse();
}
}
let resultMessageTrue = `<strong>${lowerCaseInput}</strong> is a palindrome`;
let resultMessageFalse = `${lowerCaseInput} is not a palindrome`;