coffeescript Destructuring Assignment First and Last Element


Example

array = [1, 2, 3, 4]

[first] = array # 1

[..., last] = array # 4

[first, middle..., last] = array # first is 1, middle is [2, 3], last is 4