Assessment wanted for: Image Gallery

Here’s the instructions and live example.

Here’s my code.

My question is on the lighten/darken button. The instructions suggested doing it using btn.setAttribute, but I did it using evt.target.className. Is there a reason you would use one over the other, or are they interchangeable methods?

The main reason here is we know which element we want to manipulate and we already have a reference to it here:

const btn = document.querySelector('button');

If you are confident that the element you want is indeed the one referenced by evet.target you should be good to go.

1 Like