Learn Form Validation by Building a Calorie Counter - Step 90

Tell us what’s happening:

why my code wrong?

the Instuction said
It is time for another loop. Create a for...of loop with a variable called container to iterate through the inputContainers array.

Inside the loop, set the innerHTML property of the container to an empty string. This will clear all of the contents of that input container.

Your code so far

function clearForm() {

const inputContainers = Array.from(document.querySelectorAll('.input-container'));

for (let container of inputContainers){

container.innerHTML = "";




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.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

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

Welcome to the forum @youthomas29

Try using the same key word in the for… of loop as your other function.

Happy coding

im still super confused…please can you give me the exact answer?

The tests are very specific regarding code. So even if the code is correct, the tests may fail.

I noticed instead of let you used a different keyword to declare the variable in another function.

Try using the same keyword as the other function.

There are rules in the forum against giving direct solutions.

The test is invalid because it doesn’t account for all valid variable declarations so I created an issue for it here

For now, I would suggest moving onto the next step :+1:

1 Like

thanks, so im not wrong hehe

1 Like

I will suggest he reset the step and put in the exact code again.

I think i just find the problem : container.innerHTML = “”; is wrong try using `` instead.