Proposals: Destructuring assignment #560
Labels
backlog
Project which can't be done in short amount of time or which need more discussion.
category:feature-request
A feature request, i.e: not implemented / a PR.
domain:suggestion
A suggestion, i.e: new ideas, optimization, etc.
package:core
Related to share domain nor script interpreter
priority:low
Unpacks values from arrays into distinct variables. This capability is similar to features present in languages such as JavaScript, Perl and Python.
Syntax
Default value
Each destructured property can have a default value. The default value is used when the property is not present, or has value
null
.The default value MUST be type of the right-hand side. So the following code will be thrown an exception:
Rest property
As you can see in syntax section, you can end a destructuring pattern with a rest property(
...rest
). This pattern will store all remaining properties of the array into a new array.The rest property must be last in the pattern, and must not have atrailing command.
The text was updated successfully, but these errors were encountered: