Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRyan Schmelter
9,710 PointsUsing the same code as in the video, I didn't use the if statement. It still works. Wondering why?
I didn't use the if statement to prevent last list item from jumping to the top when pressing the down button. The code works (it's the same as in the video, just without the if statement). And still the list items doesn't jump with this conditional. Any explanation why this would be the case?
Peter Csakany
3,925 PointsPeter Csakany
3,925 PointsWhen you want to move the last element down it wouldn't jump to the top as if you check the code we are moving the next element above the current one hence the illusion that it's moving down. By the last element there is no next element to move so you won't see any change the page works although the console will show you an error message if you inspect the page.