Pure win: Array.from and Array.of

Dmitry A. Soshnikov dmitry.soshnikov at gmail.com
Sun Jul 10 11:36:43 PDT 2011


On 10.07.2011 22:26, John-David Dalton wrote:
> I dig Array.from, and have manually made sugar for that in my projects.
> Array.of is something I have also wanted though I had been struggling
> with a name for it.

It's interesting -- can you show where and how?

> Until now if I wanted to avoid setting the array length I would do
> something like ns.Array.from([23]),

What. Is. That. ?

Isn't just [23] is enough?

Guys, I understand we need `Array.from` as a good addition. Note -- it's 
just the addition to be able use array methods. We though can do it and 
without it via call and apply since most of array methods are generic.

>   but Array.of is nice too ;)
>

Can maybe you show me a real useful example of Arra.of?

Dmitry.


More information about the es-discuss mailing list