for Loop in JavaScript

Posted on: October 3rd, 2022
By: Tadeo Martinez

let menuItems = document.querySelectorAll('.menu-item');
// console.log(menuItems);

for (i = 0; i < menuItems.length; i++){
    console.log(menuItems);
    menuItems[i].addEventListener('click',closeMenu);
    // console.log('menu item clicked');
}

Have any questions or comments? Write them below!


Leave a Reply

Your email address will not be published. Required fields are marked *