Can someone explain me why both solutions to step 8 work? As far as I know the second one, which the task tells me to do, shouldn’t work, because I didn’t declare a ‘door1’ variable. So why does it work? And is the first solution better or doesn’t it matter?
Inside the script.js file, underneath your global variable, assign door1.onclick to a new, empty arrow function.
You are indeed correct. And it has been addressed to the staff multiple times. Your solution 1 is the proper one, the cause of solution 2 working may be in the back-end of the exercise. Other people ask the same question ;). Goed bezig!
Just adding a bit more, I’m working on this project now and Solution 1 provided by @sylvesterhofstra doesn’t work at all for me, only Solution 2 works. Furthermore, the walk-through video uses solution 2 and as mentioned it’s not clear why how it even works as “door1” is never declared as a variable in the code.