Assessment wanted for Loops skills tests 1-3

Hi!

Any feedback on my loops skill test would be much appreciated :slight_smile:

The problems are found here:

My codepens are as follows:

Loops 1: https://codepen.io/saskiabt/pen/dyJjdzd

Loops 2:

Loops 3:

Hi @sskbinder

Welcome back! Here are my comments:

  • Task 1: You misunderstood the question. Every array element should be in its own <li>. It should look something like this:
    • tomatoes
    • chick peas
    • onions
    • rice
    • black beans
  • Task 2: No matter which name I choose I always get the last number “2282”; even if I choose an inexistent name. The problem is in the if condition. Can you spot it?
  • Task 3: Correct! :tada:

Please ask if you need more help. :slightly_smiling_face:

Happy coding,
Michael

1 Like

Thank you!

1 should be working now:

I realized the problem for #2 - I used = (assignment) instead of === (strict equivalency) in the if… loop. Should work properly now.

Thanks this was super helpful!!

1 Like

Great improvements, @sskbinder!

You could even make task 1 simpler: You add a comma in the template string and then remove it on the next line. You could just write

bullet.textContent = myArray[i];

and remove the next line. No need for a template string at all. :slightly_smiling_face:

Task 2 is perfect now! :+1:

1 Like