title: How to add Eventlistener for all Elements in the page which thier ids are inside my Array using javascript
body: <p>I have elements with Ids in my page. Also I have an Array, which includes the Ids.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const locations = [{
      "location": "hauptbahnhof",
      "color": "Magenta"
    },
    {
      "location": "Kröpke",
      "color": "Yellow"
    },
    {
      "location": "KröpckeUhr",
      "color": "Green"
    },
  ]
  for (var i = 0; i &lt; locations.length; i++) {
    var ids = locations[i].location;
    console.log(ids);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="container"&gt;
    &lt;div id="hauptbahnhof"&gt;Hauptbahnhof&lt;/div&gt;
    &lt;div id="Kröpke"&gt;Kröpke&lt;/div&gt;
    &lt;div id="KröpckeUhr"&gt;Kröpcke Uhr&lt;/div&gt;
    &lt;div id="Drumstreet"&gt;Drumstreet&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>It gives me all locations out. 
  Now I want to add Eventlistener for all Objects in my page which the Array includes thier Ids using javascript.</p>