Learn Form Validation by Building a Calorie Counter - Step 90

Tell us what’s happening:

Your for loop should iterate through the inputContainers array. Remember to use i as your iterator.

Your code so far

for (let i = 0; i < inputContainers[i].document.querySelectorAll(''); i++){

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:

Learn Form Validation by Building a Calorie Counter - Step 90

Can you explain why you used this?

“Inside the loop, set the innerHTML property of the element at the current index to an empty string.”

You forgot to do this part.

Can you help me get further information for this challenge.

for (let i = 0; i < inputContainers[i].innerHTML(""); i++){

The instructions say:

“Use a for loop to iterate through the inputContainers array.”

So you want to iterate through the array starting at index 0 and ending at the last index in the array. You started the for loop out correctly by setting i to 0. What I need you to explain is this part:

i < inputContainers[i].innerHTML("");

This is used to stop the for loop. Can you explain your thinking on how this will stop the for loop after hitting the last index in the array?

Thanks for sharing bbs. I got it this way.

for (let i = 0; i < inputContainers.length; i++) {
     inputContainers[i].innerHTML = '';
1 Like