Learn Form Validation by Building a Calorie Counter - Step 90

Tell us what’s happening:

I keep getting this message: Your for loop should iterate through the inputContainers array. Remember to use i as your iterator.
Help

Your code so far

function clearForm() {
let inputContainers = Array.from(document.querySelectorAll(‘.input-container’));
for(let i = 0; i < inputContainers.length + 1; i++){
inputContainers[i].innerHTML = “”
}

}

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

function clearForm() {
  let inputContainers = Array.from(document.querySelectorAll('.input-container'));
  for(let i = 0; i < inputContainers.length + 1; i++){
    inputContainers[i].innerHTML = ""
  }

}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 90

Why are you adding 1 to the length? If you start from index 0 where will you end up?

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