I'm trying to get the current selected text value of a dropdown menu with javascript as a global variable.
At the moment I'm having the problem that the global variable desc is empty and it shows "undefined" in the console.
This is the script:
    var desc;
    const areaSelect = document.querySelector(`[id="test"]`);
    areaSelect.addEventListener(`change`, (e) => {
        const select = e.target;
        const value = select.value;
        desc = select.options[select.selectedIndex].text;
          
    });
    
console.log(desc);
And I´ve made the JSFiddle.
