This project is read-only.

ES6 Destructing Assignment

Topics: Language Specification
Aug 16, 2013 at 5:05 AM
Is there any chance we could get ES6 destructuring assignment, as shown in:

As far as I can tell, there wouldn't be any significant codegen problems.

var [firstElem, secondElem] = arr;

var [head, ...tail] = arr;

var { arrayProp: [first, { second }] } = complicatedObj;
would become:
var firstElem = arr[0];
var secondElem = arr[1];

var head = arr[0];
var tail = arr.slice(1);

var first = complicatedObj.arrayProp[0];
var second = complicatedObj.arrayProp[1].second;
Aug 16, 2013 at 3:12 PM
This is definitely something we're looking at, but I wouldn't expect to see it until post 1.0.