Palindrome Checker Project Test Fail

Tell us what’s happening:

Hello everyone,

I’m currently working on the Palindrome Checker project in the JavaScript Algorithms and Data Structures Certification course on FreeCodeCamp. I’ve written a solution that seems to work correctly when I manually test it with various inputs. It correctly identifies palindromes and non-palindromes and returns the expected true/false values.

However, I’m encountering an issue where my solution isn’t passing the automated tests on FreeCodeCamp. Every time I run the tests, it fails, even though the manual checks with the same inputs pass flawlessly.

I’ve tried debugging and checking for common pitfalls, such as case sensitivity and non-alphanumeric characters, but haven’t been able to identify the cause of the issue. I’m wondering if there might be a specific format or an edge case that I’m overlooking, which is required by the FreeCodeCamp testing suite.

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="styles.css" />
    <title>Palindrome Checker</title>
    <h1 id="title">Is it a Palindrome?</h1>
    <p>Maybe not, Maybe yes. Check for yourself!</p>
      <div id="result">
        <p>Enter in text to check for a palindrome:</p>
        <input type="text" id="text-input">
        <button id="check-btn">Check</button>
        <div id="result-text"></div>
    <script src="./script.js"></script>
/* file: styles.css */
* {
  font-family: roboto
/* file: script.js */
const textInput = document.getElementById("text-input");
const button1 = document.getElementById("check-btn");
const result = document.getElementById("result-text");

button1.addEventListener("click", ()  => {
  if (textInput.value === "") {
    alert("Please input a value")
  } else {
    const originalText = textInput.value.toLowerCase().replace(/[^a-z0-9]/g, "");
    const reverseText = originalText

    palChecker(originalText, reverseText, textInput.value);

const palChecker = (lowerOr, reverse, original) => {
  if (lowerOr === reverse) {
    result.textContent = `${original} is a palindrome`;
    return true;
  } else {
    result.textContent = `${original} is not a palindrome`;
    return false;

Your browser information:

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

Challenge Information:

Build a Palindrome Checker Project - Build a Palindrome Checker

I think your problem lies with instruction #3.

1 Like

OMG, thank you! Such a small error but it made me crazy :rofl: