title: How to make a condition for event 'click' inside/outside for multiple divs?
body: <p>I have a <code>html</code> And <code>js</code> as below :</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>document.addEventListener('click', myFunction())
  
  function myFunction(e) {
    let inputs = document.querySelectorAll('.my-element');
    let m = inputs.forEach((el) =&gt; el.contains(e.target));
    if (!m) {
      console.log('Element');
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="my-element" style: "width:100px; height: 100px"&gt;
  &lt;/div&gt;
  &lt;div class="my-element" style: "width:100px; height: 100px"&gt;
  &lt;/div&gt;
  &lt;div class="my-element" style: "width:100px; height: 100px"&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>The problem is, the condition works even if I click inside the target. I need that the condition works only if I click outside of the elements. What my mistake is?</p>