title: If Else statement in JavaScript not functioning correctly in Internet Explorer
body: <p>The below JavaScript <a href="https://stackoverflow.com/a/21712356/7968468">If/Else statement</a> works correctly in identifying if the browser is IE11, with the result being that in IE the console prints "Internet Explorer" and in all other browsers prints "Not Internet Explorer":</p>
  
  <pre><code>if (window.document.documentMode) {
    console.log("Internet Explorer");
  }
  else {
    console.log("Not Internet Explorer");
  }
  </code></pre>
  
  <p>However if I place something like a Fetch in the Else statement (which is not compatible with IE and should also not be read by IE) I will get a Syntax Error in the IE console:</p>
  
  <pre><code>if (window.document.documentMode) {
    console.log("Internet Explorer");
  }
  else {
    console.log("Not Internet Explorer");
    fetch('https://randomuser.me/api/?results=10')
      .then(response =&gt; response.json())
      .then(data =&gt; console.log(data));
  }
  </code></pre>
  
  <p><strong>SCRIPT1002: Syntax error</strong> pointing to the first response of the Fetch:</p>
  
  <pre><code>.then(response =&gt; response.json())
  </code></pre>
  
  <p>Could someone advise what I'm doing wrong?</p>