SCRIPT438 Error in Internet Explorer 11
<p>I've been working on JavaScript lately, and everything was fine until I opened my page in <strong>IE11</strong>. as per <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach" rel="noreferrer">Mozilla website</a> <code>.forEach</code> is supported from IE9.</p>

<p>This is the error I got.</p>

<blockquote>
  <p>SCRIPT438: Object doesn't support property or method 'forEach'</p>
</blockquote>

<p>and this is the code.</p>

<pre><code>var link1 = document.querySelectorAll("nav a");
    var textbox = document.getElementById("OutputWindow");
    link1.forEach(function (element) {
        textbox.innerHTML += "&lt;br/&gt;" + element + "\n";
        element.onclick = function () {
            alert("Hello!");
            console.log("hello!");
            confirm("Hello!");
        };
    });
</code></pre>

<p>I tried polyfill, but to my amusement, <code>Array</code> has a <code>forEach</code> in <strong>IE11</strong>.</p>

<p>Then where I'm going wrong?</p>

<p><strong>PS:</strong> This works fine in Chrome. </p>