JavaScript JavaScript and the DOM Traversing the DOM Solution: Using nextElementSibling

slurpee
slurpee
6,694 Points

down button is not working and need help understanding

https://w.trhou.se/j0fv6586fl

when I view the other buttons work but down button doesn't.

also can someone help me understand what's happening. cause I'm second guessing my self on understanding all this. please thank you

1 Answer

Steven Parker
Steven Parker
172,106 Points

The test that checks for a "down" button is currently inside that code block for the "up" button, so that condition will never be true and the code will never run. These two sections of code should be peers instead of nested.

One way to fix it would be to move the close brace from line 34 and place it between lines 23 and 24.