JavaScript JavaScript and the DOM Making Changes to the DOM Appending and Removing Nodes

Mohamed Boussaid
Mohamed Boussaid
2,534 Points

Why 'p:last-child' false?

Hello,

Argument 'p:last-child' returns false? Why? :s

Ella Ruokokoski
Ella Ruokokoski
20,851 Points

what part of the lesson this question is related to?

2 Answers

Ella Ruokokoski
Ella Ruokokoski
20,851 Points

in the task you have two elements stored in variables (div and p) you are just supposed to fill in the blanks and place the element stored in the p variable as the last child of div variable. You do not need any :last-child selector because p is a variable name and appendChild will place that element stored in p as a last child of the div.

Mohamed Boussaid
Mohamed Boussaid
2,534 Points

Its from quiz question:

Place the new element p as the last child of the element stored in the div constant.