Need A Lot of Assistance From An Actual js Dev

Hi and welcome to the art of programming!

I started writing a longer answer but saw that @mindriot already answered. Like @mindriot I also think you got the looping right but were confused by the decision logic inside of it.

Programming can be quite abstract and it can sometimes help to try to reframe the problem into something more tangible. Maybe this helps or gives inspiration to future problems:

Say that you have a group of people in a large room and you want to give them each a clothing item depending on their color preferences. A red t-shirt with the logo Fizz if they like red, a blue hat with the logo Buzz if they like blue and both the t-shirt and the hat if they like both colors.

You put them in a line (the for loop) and start with the first person who happens to only like red. When asked “Do you like red?” and answer “Yes!”, the person is given a red t-shirt.

You then move to the next person and ask the same question:

“Do you like red?”
“No, I really don’t”
“Do you like blue?”
“I do!”

At this point a blue hat is given out and you move on to the next person again. The third person in line happens to like both red and blue and is looking forward to be given both a t-shirt and a hat. But when asked:

“Do you like red?”
“I do…”

Imagine the dissapointment when you hand out a red t-shirt and move on.

“If only they had asked the questions in a different order”, the third person mutters and reluctantly puts on the t-shirt.

Similarly, to apply the same metafor to the authors implementation. In this scenario instead of handing over the merchandise directly upon an affirmative response, the item is put in a bag (output) where multiple items can be put before handing it over.

Ie. something along the lines of:

  1. The questioner prepares an empty bag (let output = "").
  2. “Do you like red?”, “Yes!”. A red t-shirt is put in the bag. (output += "Fizz")
  3. “Do you like blue?”, “Yes!”. A blue hat is put in the bag. (output += "Buzz")
  4. The bag is handed over containing a red t-shirt and a blue hat.
    (console.log(output)).
5 Likes