mercredi 6 octobre 2021

if I don't return anything after if statement in if-else ladder; what will be the default return value?

suppose I write a if-else statement like this :

      const dropItem = document.querySelectorAll('.menu-content67');
        dropItem.forEach((dItem) => {
            let hideIcon = dItem.querySelector('.hide-icon67');
            hideIcon.addEventListener('click', () => {
                dropItem.forEach((dItem2) => {
                    if (dItem !== dItem2) {
                        dItem2.classList.remove('showMenu')
                    }
                })
                if (dItem.classList.contains('showMenu')) {
                    dItem.classList.remove('showMenu')
                }
                else {
                    dItem.classList.add('showMenu')
                }
            })
        })

now I want to find the return value for below portion

dropItem.forEach((dItem2) => {
                    if (dItem !== dItem2) {
                        dItem2.classList.remove('showMenu')
                    }
                })

Aucun commentaire:

Enregistrer un commentaire