Build a Palindrome Checker Project - Build a Palindrome Checker

Tell us what’s happening:

I need help reformatting my palindrome code for html, css and javascript, many thanks! There’s nothing wrong with the scripts however it’s all jumbled up!

Your code so far

<!-- file: index.html -->
<input id="text-input">
<button id="check-btn">
   <div span id="result">
<script src="script.js"></script>

/* file: script.js */
const textInput = document.getElementById("text-input"); 
const checkButton = document.getElementById("check-btn"); 
const result = document.getElementById ("result"); 

checkButton.addEventListener("click",() => {
if (textInput.value === "") {
  alert("Please input a value") 
 } else if (textInput.value.length === 1) {
  result.innerText = `${textInput.value} is a palindrome`
} else if (textInput.value ===[...textInput.value].reverse().join(("")) {
result.innerText = `${textInput.value} is a palindrome`
}
});
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1 Safari/605.1.15

Challenge Information:

Build a Palindrome Checker Project - Build a Palindrome Checker

Right click in the editor and select Format Document, do it for each file

Can you show me manual step by step instructions, i.e. downloadX…?

There is no download? Do you know how to use the right click button on your mouse?

Yes I know how to do so.

Then right click and select the Format Document option.

those are instructions for the freeCodeCamp editor, weren’t you using that?

Tell us what’s happening:

I think I’m nearly there for completing the assessment, can you spot the errors here as usual I want to get this daunting task out of the way!

Your code so far

<!-- file: index.html -->
<input id="text-input">
<button id="check-btn">
   <div span id="result">
<script src="script.js"></script>
/* file: styles.css */

/* file: script.js */
console.log("hi")

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));

console.log(inputArr)
for(let i = 0; i<inputArr.length; i++){
  if(inputArr[i] !== inputArr[inputArr.length - i - 1]){
    console.log(inputArr[1])
    result.innerText = `${inputText}
  is not a palindrome`
  return
}
}
result.innerText = `${inputText}
  is a palindrome`
}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1 Safari/605.1.15

Challenge Information:

Build a Palindrome Checker Project - Build a Palindrome Checker

Hi there!

How that function will be used to functional your palindrome checker.?

You didn’t have the check-btn click functionality.

I have edited your post to remove `Preformatted text` from your link to make it usable

This is a final project, you are expected to do more of the debugging on your own. Can you describe how your app work?
what do you expect to happen and what is the code responsible for that?