JS addEventListener à largura da janela

const removetogglenav = ()=>{
    if(window.innerWidth > 780){
        console.log(window.innerWidth);
    }
}

window.addEventListener('resize', removetogglenav);
Strange Snake