Assessment requested for Loops 1 skill test (Ekeblad)

Hi,
I just completed the first of the three assignments and I see that I’m one of the few using forEach instead of a regular For-loop. Could this be assessed?

Thanks!

Codepen Loops 1

Hello @Ekeblad

you doing great well done and you can improve the code more if you like

function addListItem(item) {
      
      console.log(item);
      const listItem = document.createElement("li");
      listItem.textContent = item;
      list.appendChild(listItem);
    }

item will be each element using the foreach and since we do not need anything else then no need for index

check this for more details about foreach for array

hope that help and have a nice day :slight_smile:

2 Likes

@justsomeone: Your probably wanted to link to

No WebXR exercises on MDN yet :grin:

2 Likes

ops i am guilty :joy:

@mikoMK thanks for correcting me well done boss :wink:

@Ekeblad sorry use the link that @mikoMK mention mine is wrong

and have a nice day both of you :slight_smile:

2 Likes

Hi @justsomeone,
I have looked into your suggestion and it does the same as mine did with a few rows more and one more input which was not used in this case. Thanks for the help!

Have a nice day! :slightly_smiling_face:

1 Like

you very welcome @Ekeblad and thanks a lot

1 Like