Assessment wanted for JS Image gallery

Here are the links : MDN and Codepen.

I want to know if I did it well. And by the way, I first tried it by putting the dl variable in the global scope outside the function. I also need an explanation about that.

Thank you in advance for your help !

Hello @TheRealSuperhuman

you doing great well done but looks like you changed the css file that why it does not look like the finished example

for the

you need to update the value of dl inside the dlbutton() function to make it work

so it would looks like that

function dlbutton() {
  dl = btn.getAttribute('class');
if (dl === 'dark') {

which would be not good to define it in the global scope

it recommend to define variable the closer possible way to it first use

hope that help and have a nice day :slight_smile:

1 Like