I have this feeling that I already tried everything and searched in several places for solutions but nothing works for me. I need to take out the updated mv value from addEventListener
HTML
<ul class="products" id="searchResult"> </ul>
<li multip="1.6"> scrambled eggs </li>
<li multip="1.2"> rice </li>
JS
const list = document.querySelector('ul');
var mv;
list.addEventListener('click', e => {
mv = e.target.getAttribute("multip");
});
console.log(mv);
So I understand I can't read the updated mv value because it is declared locally, however, is there is any way to reach it globally?