Student-friendly HTML, CSS, and JavaScript reference with examples
Loops through each item in an array or NodeList.
const buttons = document.querySelectorAll('button');
for (const button of buttons) {
button.classList.add('styled');
}
Perfect for looping through querySelectorAll results.