I have the following code
function searchFlights() { var select1 = document.getElementById(\"airports-select-1\"); var selected1 = []; while(select1
Another approach for those who like a more functional style:
selections = Array.from(selectBox.options).filter(o => o.selected).map(o => o.value)
or
selections = Array.from(selectBox.selectedOptions).map(o => o.value)