JavaScript JavaScript and the DOM Responding to User Interaction Listening for Events with addEventListener()

Brian Patterson
Brian Patterson
19,586 Points

Why is this not working

In the console, it is saying that toUppercase is not a function. Not sure what I have done wrong. I think I have typed this word for word.

for (let i = 0; i < listItems.length; i+=1) {
    listItems[i].addEventListener('mouseover', () => {
    listItems[i].textContent = listItems[i].textContent.toUppercase();

    listItems[i].addEventListener('mouseout', () => {
      listItems[i].textContent = listItems[i].textContent.toLowercase();

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Staff

Hi there! You're doing fantastic, but remember, just about everything in programming is case-sensitive. There is no toUppercase() nor toLowercase() function. There is, however, a toUpperCase() function and a toLowerCase() function. Note the capitalization of the "C" in both of these.

Hope this helps! :sparkles: