Array.map(mapFn) calls the mapFn(v,i,a) passing the currentValue,
currentIndex and the array it is iterating over as arguments.
I was happy to find out about Array.from(itterable, mapFn, thisArg), but
unfortunately, the mapping didn't work as expected.
It seems, Array.from doesn't pass in the newly created array to the mapFn.
Why is that?
For instance I was expecting Array.from("aabc", (v,i,a) => { if(a[i] ===
a[i-1]) a.splice(i,1) }) to evaluate to ["a","b","c"], but a is undefined.
Is there a reason why the mapFn isn't called the same way as an Array.map
function is?
-John
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss