On Tue, Oct 7, 2014 at 11:46 AM, Domenic Denicola < [email protected]> wrote:
> From: es-discuss [mailto:[email protected]] On Behalf Of > Dmitry Soshnikov > > > Am I still missing something? > > Yes. > > ```js > var uint16s = new Uint16Array([258]); > var uint8s = Uint8Array.from(uint16s, x => x / 2); > console.log(uint8s); // [129] > ``` > > ```js > var uint16s = new Uint16Array([258]); > var uint8s = Uint8Array.from(uint16s).map(x => x / 2); > console.log(uint8s); // [1] > ``` > This seems the same "issue" as with the `NodeList`. The arguments for the `from` should be anything that the constructor expects, if the `NodeList` excepts a document node, it should be passed a document node, not a string. I.e. the array should be mapped _before_ passing to the `from`. ```js var uint16s = new Uint16Array([258]); var uint8s = Uint8Array.from(uint16s.map(x => x / 2)); console.log(uint8s); // [129] ``` Is it? Otherwise, we can back to the question why it doesn't do filter as well? Dmitry
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

