document.querySelectorAll()
Find all matching elements on a page. You can use any valid CSS selector.
// Get all button elements
let buttons = document.querySelectorAll('button');
// Get all elements with the .bg-red class
let elemsRed = document.querySelectorAll('.bg-red');
// Get all elements with the [data-snack] attribute
let elemsSnacks = document.querySelectorAll('[data-snack]');