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!
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 trial
Mike Salomone15,610 Points
Why select ul and then remove child rather than just typing listItem.remove()?
title says it all.
John Coolidge12,614 Points
After browsing the Mozilla Development Network, I couldn't find any real difference between the two as far as browser compatibility was concerned. I do know that with removeChild() you can save the removed child in a variable to be appended later on.
var oldChild = parent.removeChild(child);
Ron Starski1,997 Points
removeChild() works on every browser while remove() is not that universal. On MDN remove() is marked as an experimental feature.