I'm trying to count the characters that the user types in the textarea and display that value in a span tag.
I'm receiving this error: Uncaught TypeError: Cannot read properties of undefined (reading 'length')
const prompt = document.querySelector("#floatingTextarea2");
const wordCount = document.querySelector(".word-counter")[0];
prompt.addEventListener("input", updateCount());
function updateCount() {
const count = this.value.length;
console.log(count);
wordCount.innerText = count;
}