IE supports forEach(…) when invoked fromthe console but not when called from the code
问题 I'm running this snippet the console. In IE it produces the output just as expected. Running the same in Cr and FF for reference confirms the congruence of behavior. ["a", "b"].forEach(function(element) { console.log(element); }); However, when running the following script, I'm getting errors telling me that the object hasn't forEach(...) declared on it. The issue occurs in IE but not in Cr nor FF. var menus = document.querySelectorAll("ul.application>li>a"); menus.forEach(function(element) {