let buttons document querySelectorAll button divs document querySelect

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
let buttons = document.querySelectorAll('button'),
divs = document.querySelectorAll('div');
buttons.forEach(function (button) {
button.onclick = function () {
divs.forEach(function (div) {
div.classList.toggle('red')
})
}
});