What is the difference between `querySelector` and `querySelectorAll`?

A. `querySelector` returns all matching elements; `querySelectorAll` returns the first match.
B. `querySelector` returns the first match; `querySelectorAll` returns all matching elements.
C. `querySelector` only works with class selectors; `querySelectorAll` works with all selectors.
D. `querySelector` returns a NodeList; `querySelectorAll` returns a single element.



Answer :

Final answer:

In JavaScript, querySelector returns the first matching element, while querySelectorAll returns all matching elements.


Explanation:

querySelector returns the first match, while querySelectorAll returns all matching elements.

querySelector: document.querySelector('div') selects the first div element.

querySelectorAll: document.querySelectorAll('div') selects all div elements on the page.


Learn more about JavaScript querySelector vs. querySelectorAll here:

https://brainly.com/question/43021576