Clarify the destructuring syntax

Егор Николаев termi1uc1 at
Fri Apr 11 03:35:55 PDT 2014

1. Should the AssignmentExpression of DestructuringAssignment always to be
the Object type?
let {length} = "123";
assert(length, 3);
Is this valid?

If it is:
2. Should the result of Get(obj, name) always be the Object type if
DestructuringAssignmentTarget is an ObjectLiteral or an ArrayLiteral?
According the spec step 4.b this expression is invalid:
let {text: {length}} = {text: "123"};
assert(length, 3);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list