I'm passing array to Map constructor like this:
let arr = [['a', 1], ['b', 2]];
let map = new Map(arr);
IE11 returns empty object.Documentation says that passing iterable to constructors in IE11 is supported only as arrays of key/value pairs, but its not working. Anyone have this issue?
I've found it on MDN docs.
Now I know I can't always rely on MDN.
MDN is specific to Firefox, being from the Mozilla Development Network. Most browsers behave the same or similar, as Firefox tries to stay as close as it reasonably can to the specs, but sometimes there are differences/improvements, such as with this.
It works for me.
Using var in IE11 is different Jeff from using let.
Can it work in IE11 when using var?
var arr = [['a', 1], ['b', 2]];
var map = new Map(arr);
Yes, that on testing works with IE11.
I have to retract my "it works for me" statement. I happened to be on the google homepage when I ran that in the console, but I discovered the same code doesn't work in the console on other pages. It looks like it only worked for me before because google polyfilled/monkey patched the implementation of Map on their site.
I'm more disappointed to say that perhaps MDN did indeed have wrong information in this case. They claimed IE11's Map could be initialized with an array of key/value pairs, but that doesn't seem to be the case.
Thanks Jeff for helping to explain that mystery.
IE11 doesn't like using let or const from the console, even though you can use them from codeIE11 doesn't support Map constructor arguments.
Full details on the ES6 support from IE11 is found at the ES6 compat table
Thank you Jeff for submitting an issue to MDN about the IE11 map.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.