var boxes = [...document.querySelectorAll(".deletionCheckBox"), document.querySelector("#checkboxGlobal")].filter(Boolean); boxes.forEach(box => box.checked = !box.checked);