Build a Real Time Counter - Build a Real Time Counter

Tell us what’s happening:

my output is correct but it cant pass i want to know why

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>Real Time Counter</title>

    <link href="styles.css" rel="stylesheet">

</head>

<body>
    <p id="char-count">Character Count: 0/50</p>

<textarea id="text-input" ></textarea>

<script src="script.js"></script>
</body>


</html>
/* file: styles.css */

/* file: script.js */
let textInput = document.getElementById('text-input')

let pCount = document.getElementById('char-count')

textInput.addEventListener('input', () => {

  if (textInput.value.length >= '50') {

    pCount.textContent = `Character Count: ${textInput.value.length}/50`

    textInput.setAttribute('maxlength', '50')

    pCount.style.color = 'red'

  } else {
    pCount.textContent = `Character Count: ${textInput.value.length}/50`
  }

})

Your browser information:

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

Challenge Information:

Build a Real Time Counter - Build a Real Time Counter
https://www.freecodecamp.org/learn/full-stack-developer/lab-real-time-counter/build-a-real-time-counter

Here are some basic troubleshooting steps you can follow. Focus on one test at a time:

  • What is the requirement of the first failing test?
  • Double check the related User Story and ensure it’s followed precisely.
  • What line of code is involved?
  • What is the result of the code and does it match the requirement? You can write the value of a variable to the console at that point in the code to check if needed.
  • Is there any other output or messages in the console to follow up on?

If this does not help you solve the problem, please reply with answers to these questions.