Rainbow exercise assignment issue

Hello. I’m working my way through a Udemy course and this assignment wants me to iterate over a list of spans using a loop. Here is the assignment explanation:

And here is one of the loops I tried. I think I’m grabbing the source wring. But there are different ways to loop over this. But I also think I have a good start or base.

Let me know what you think! Thanks

you need to call querySelectorAll and give it an argument

1 Like

I also think I’m referencing (calling) the wrong element. I can’t figure out how to call and grab the span elements for each color to star t looping.

There are 7 elements (colors) in the colors array. There are also 7 span elements that will be in the node list you create with querySelectorAll. You should be able to use the corresponding indices of each array to get the desired result.

Can you post your latest code attempt? To you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like

I know I’m just building my syntax wrong. Either I’m using the the wrong argument for querySelectorAll or I’m not referencing how I should.

in what you have showed so far it doesn’t have an argument at all

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