For each Loop
let accBox = document.querySelectorAll('.accBox');
for (i = 0; i < accBox.length; i++) {
accBox[i].addEventListener('click', function () {
accBox.forEach(el => {
el.classList.remove('active'); });
this.classList.toggle('active');
});
} let accBox = document.querySelectorAll('.accBox');
for (i = 0; i < accBox.length; i++) {
accBox[i].addEventListener('click', function () {
accBox.forEach(el => {
el.classList.remove('active'); });
this.classList.toggle('active');
});
}How can I convert this on to forEach code
