← Quiz: DOM and Events: all 10 questions
Quiz: DOM and Events · Question 8 of 10
Which pair of methods creates a new <li and puts it at the end of a list?
Which pair of methods creates a new <li> and puts it at the end of a list?
- A.document.querySelector and remove
- B.document.createElement("li") and list.append(li)
- C.addEventListener and preventDefault
- D.innerText and textContent
Answer & explanation
Correct answer: document.createElement("li") and list.append(li)
createElement builds the node; append (or appendChild) adds it to the DOM.
Can you get the rest right without peeking?
Take the timed Quiz: DOM and Events quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →