Build a Palindrome Checker Project - Build a Palindrome Checker

Hello I am trying to make my result element display “A is a palindrome” when only “A” is entered into the field and “check-btn” is clicked I believe my way would work but to no avail please help.

Your code so far

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

/* file: script.js */
const btnChecker= document.getElementById("check-btn")

const txtinput = document.getElementById("text-input")

const result = document.getElementById("result")

const e = btnChecker.length
btnChecker.addEventListener(
  "click", (e=0) => alert("please input a value"))

if(txtinput==="A" && btnChecker.clicked)
  {result.innerText = "A is a palindrome"}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 OPR/107.0.0.0

Challenge Information:

Build a Palindrome Checker Project - Build a Palindrome Checker

You can not have a list of all known palindromes.

  1. You need to understand what a palindrome is.

  2. You need to programmatically check if the input is a palindrome.

  3. How would you change the input to check if it is a palindrome?


What is it you believe this code does?

const e = btnChecker.length

= is an assignment operator

(e=0)

txtinput is an element, you need the value on that element.

What is this code suppose to do?

&& btnChecker.clicked

Okay, thank you for the feedback I’ll work on it.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.