<ul>
<li></li>
<li></li>
<li></li>
</ul>
const li = document.querySelectorAll('li');
document.addEventListener('mouseover',e=>{
let targ = e.target.closest('li');
if(!targ) return;
[...li].forEach(item=>item!==targ?item.style.visibility='hidden':null);
targ.addEventListener('mouseleave',()=>{
[...li].forEach(item=>item.style.visibility='visible');
})
});