← Quiz: DOM and Events: all 10 questions
Quiz: DOM and Events · Question 6 of 10
What does document.querySelectorAll(".task") return?
What does document.querySelectorAll(".task") return?
- A.Only the first element with class task
- B.A list (NodeList) of all elements with class task
- C.The number of matching elements
- D.A copy of the HTML as a string
Answer & explanation
Correct answer: A list (NodeList) of all elements with class task
querySelector returns the first match; querySelectorAll returns all matches.
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 →