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 trial

JavaScript JavaScript and the DOM (Retiring) Making Changes to the DOM Appending and Removing Nodes

Challenge does not make sense?!

The Challenge asks wether this is true or false:

"The removeChild method can be called on an element which is a child of another element."

But the syntax of the removeChild is:

<parentElement>.removeChild(child);

So the answer must be false ( which is currently not the case ) or the question should be something like that:

The removeChild method can be called on an element which is a parent of another element.

I just want to know wether I am right and should report this to the support or I overlooked something;

1 Answer

I think the statement is meant to mean:

The parent element that is used with .removeChild() can be a child of another element. So, you might use .removeChild() on a ul to remove a li, but the ul will be at least be the child of the body element.

So, this question would make sense

Let me know if this helps here

Ok, I see your point, but the question is a little bit confusing. You can target the root and remove the body The root is the root of the DOM, so it is not a child of any element. I know, they said can be a child, but every parent which is not the root is a child.