Axel Rauschmayer (2012-08-28T09:40:47.000Z)
> However, I'm still not quite sure what the use case is for this. For code generation, if you know how many elements there are and what they are enough to put them in the Array.of(...,...,...) call, why not just use [...,...,...]? Unless it's supposed to be used for converting array-likes to arrays, where I really don't think this is the best function signature. For the dart example, why not just use [] and you avoid the gotcha?

map and map-like scenarios are another use case:

[1,2,3].map(Array.of)  // [[1], [2], [3]]

But, as Domenic mentions, it does indeed compete with:

[1,2,3].map(...x => [...x])

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120828/b85fa61a/attachment.html>
domenic at domenicdenicola.com (2014-01-03T16:44:57.144Z)
> However, I'm still not quite sure what the use case is for this. For code generation, if you know how many elements there are and what they are enough to put them in the `Array.of(...,...,...)` call, why not just use `[...,...,...]`? Unless it's supposed to be used for converting array-likes to arrays, where I really don't think this is the best function signature. For the dart example, why not just use `[]` and you avoid the gotcha?

map and map-like scenarios are another use case:

```js
[1,2,3].map(Array.of)  // [[1], [2], [3]]
```

But, as Domenic mentions, it does indeed compete with:

```js
[1,2,3].map(...x => [...x])
```