3 ms·
It's even cooler than throwaway names [0]. You can index from the back: arr = [1, 2, 3] [..., two, three] = arr or look for node-style callbacks... my
by couchand 13y ago
It's even cooler than throwaway names [0]. You can index from the back:
arr = [1, 2, 3]
[..., two, three] = arr
or look for node-style callbacks...
myFun = (..., cb) ->
cb()
But you can't use it multiple times. That would allow for ambiguous syntax:
# disallowed
[..., whatAmI, ...] = [1, 2, 3, 4]
[0] https://gist.github.com/aseemk/8637896#expansion-in-array-destructuring https://gist.github.com/aseemk/8637896#expansion-in-array-de...