How to use getElementById with multiple IDs in JavaScript?

To use getElementById with multiple IDs in JavaScript, we use the querySelectorAll method.

For instance, we write

const els = document.querySelectorAll(
  "#myCircle1, #myCircle2, #myCircle3, #myCircle4"
);

to call querySelectorAll with the selector for the elements we want to select separated by commas.

A node list with all the selected elements is returned.