JSFiddle - React, Tailwind, and code Playground

HTML

<select id="select1">
    <option> cars </option>
    <option> bikes </option>
</select>

<select id="select2" onchange="myFunction()">
    <option> like </option>
    <option> dislike </option>
</select>

<div id="output"></div>

JavaScript

var selected1="";
var selected2="";
document.getElementById("select1").onchange=function(){
    var e = document.getElementById("select1");
    selected1  = e.options[e.selectedIndex].text;
    if(selected2!="")
       document.getElementById("output").innerHTML = selected1 + selected2;
    
};
document.getElementById("select2").onchange=function(){
    var e1 = document.getElementById("select2");
    selected2 = e1.options[e1.selectedIndex].text;
    if(selected1!="")
              document.getElementById("output").innerHTML = selected1 + selected2;     
};