Safari has support for ES6 Maps and Sets in version 7.1 and higher (MDN).
I\'m using a Map in my application and at some point want access to the values. Calling the v
This indeed seems to be a bug with Safari 7.1 and 8. I managed to work around this issue by first checking if the next function was available and if not, I used the for...of
construct. Because this is invalid syntax pre-ES6, I had to wrap it in an eval
statement:
m = new Map();
m.set(1, "test");
m.set("2", false);
it = m.values(); // returns an Iterator
if (typeof it.next === 'function') {
v = it.next();
// do something with v here
} else {
eval("for (v of iterator) /* do something with v here */");
}