Assessment wanted for Image gallery. (Task-1)

Assessment wanted for Image gallery. (Task-1)

Link to task:

Link to my code:

Thanks :wink:

Great work, @EiN!

Everything’s fine. Nice idea with the alt texts.
You could make the assignments a bit simpler by using the dot notation like you did with displayedImage.

And here comes the bonus question :sunglasses::
Having two connected data sets in different structures (imagesNames and altText) can be fragile. Try to rewrite them into an array of objects. Each object in the array should contain an url and an altText property with the necessary values. You can then loop over this new array to fill the imageThumbBar.

Good luck,

1 Like

Hello. Thanks for checking my code and for the bonus question :slightly_smiling_face:. Here is a link to my new code with an answer to the bonus question and a slight adjustment to the previous code:

Cool rewrite, @EiN.
Now it feels much more robust.

Since we now have all required information in our objects, we don’t need the index anymore and could now also use a for...of loop.

for (const image of images) {

But that’s more a matter of taste. I like this kind of loop. It looks simpler to me. (As long as you don’t need the index).

1 Like

Yes, you’re right, it’s really easier that way. And it is almost impossible to make a mistake, unlike my version.
Here is the modified code:

1 Like

Beautiful code ! :+1:

1 Like