Почему выводит ошибку что Uncaught ReferenceError: i is not defined at HTMLDivElement.toggleSkills
const skillsContent = document.getElementsByClassName('skills__content');
const skillsHeader = document.querySelectorAll('.skills__header');
function toggleSkills() {
let itemClass = this.parentNode.className
for (i = 0; i < skillsContent.length; i++) {
skillsContent[i].className = 'skills__content skills__close'
}
if (itemClass === 'skills__content skills__close') {
this.parentNode.className = 'skills__content skills__open'
}
}
skillsHeader.forEach((el) => {
el.addEventListener('click', toggleSkills)
});