title: How can I set a function to an event listener
body: <p>I have this function displaySelectedUser, so I want to Set displaySelectedUser as a change event listener for the <code>&lt;select&gt;&lt;/select&gt;</code> UI element using only the DOM Selector API.</p>
  
  <p>this is the code that I have tried out:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;body&gt;
  &lt;div class="select"&gt;
        &lt;select class="select-text"&gt;
          &lt;option disabled selected&gt;Select User&lt;/option&gt;
           &lt;option&gt;user 1&lt;/option&gt;
           &lt;option&gt;user 2&lt;/option&gt;
        &lt;/select&gt;
  &lt;/div&gt;
  &lt;body&gt;
  &lt;script&gt;
     const displaySelectedUser = () =&gt; {
   //some code...
  };
      document.querySelector('select').change = displaySelectedUser;   
    };
  &lt;/script&gt;
  </code></pre>