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

Sarah Breidenbach
Sarah Breidenbach
4,490 Points

How do I place the new element p as the last child element stored in the div constant (quiz question on Appending Nodes)

const div = document.querySelector('div#feedback');
const p = document.createElement('p');
____.appendChild( ____ );

2 Answers


Without quotes is Variable.

appendChild is a function which acts on a parent and appends a new child. so Parent.appendChild(NewChild). In this case, what is the Parent (ie where do you want to put what you are appending?) and what is the name of the NewChild (what do you want to append?)

Sarah Breidenbach
Sarah Breidenbach
4,490 Points

I understood the basic concept but I used quotes where I shouldn't have


I think I was thrown because the variable was named p the same as the element.

I was also confused about having it be the last child element, but I guess it's the last one automatically.