> Splats (spreads?) > f(...[1,2,3]) == 6 > ... means destructure?
f.apply(this, [1,2,3])
function f(x, y, z) { return x + y + z; } a = [1,2]; b = [3]; [...a, ...b] == [].concat(a,b) == [1,2,3] [0, ...a, 4, 5, ...b, 6] == [].concat([0],a,[4,5],b,[6]) == [0,1,2,4,5,3,6] f(...a, ...b) == 6 f(1, 2, ...b) == 6 f(...a, 3) == 6 f(...b, 0, ...b) == 6
Want some cheese with that whine? It got more complicated, yes. But I'm liking most of the changes, personally. A lot. Most of them are long overdue.
BTW, if you open Firefox's console, you can try out many examples. Firefox already supports tons of ES6.
Want some cheese with that whine? It got more complicated, yes. But I'm liking most of the changes, personally. A lot. Most of them are long overdue.
BTW, if you open Firefox's console, you can try out many examples. Firefox already supports tons of ES6.