I have this js code:
var start = new Date().valueOf(), globalFn = function() {}; for (var i = 0; i < 100000000; i++) { globalFn(); } console.log('Elapsed: ' + (new Date().valueOf() - start) / 1000);
I'm getting these results:
// Chrome Version 47.0.2526.80 m
// Elapsed: 0.203
// Firefox 42.0
// Elapsed: 0.18
// IE 11.20.10586.0
// Elapsed: 24.183
// Edge
// Elapsed: 20.939
Why it takes ~100x times more time to execute this code in IE and Edge? Are there any workarounds?
Thanks.