Assessment wanted for Image gallery task

Hello! Need assessment for Image gallery task.

Hi @VladimirK

Great job on this exercise. Congrats!

For better readability in the “darken/lighten” part I would group the changes in a if...else statement:

if (btnClass === 'dark') {
  /* set three attributes */
} else {
  /* set three attributes */
}

It’s a matter of taste. Nothing wrong with your approach. :slightly_smiling_face:

Have a nice day,
Michael

2 Likes

Hello, @mikoMK! Thank you for the feedback!

I was in doubt about this moment. If it is easier to read the code in the way you said, then I will do so. I think it saves brain resources when the code is simpler.

I wonder what is the best way to handle such situations in terms of browser performance.

1 Like

Agreed :slightly_smiling_face:

I wouldn’t think about performance in such simple situations. Unless the code gets executed thousands of times per second. That being said, from a technical perspective my version would probably be better because the conditional will only get evaluated once.

1 Like