Destructuring isn't in io.js yet

This commit is contained in:
Rico Sta. Cruz 2015-02-06 17:42:04 +08:00
parent f7d88ba0de
commit fca8924f2f
1 changed files with 13 additions and 14 deletions

27
es6.md
View File

@ -21,20 +21,6 @@ Promise.race(/*...*/)
Promise.reject(/*...*/)
Promise.resolve(/*...*/)
/*
* Destructuring
*/
// Destructuring assignment
var [first, last] = ["Nikola", "Tesla"];
let {title, author} = { title: "The Silkworm", author: "R. Galbraith" };
// Available in loops too
for (let {title, artist} in songs) {
// ...
}
/*
* Block scoping
*/
@ -107,6 +93,19 @@ export function mymethod () {
// Export a value; aka: exports.pi = ...
export var pi = 3.14159;
/*
* Destructuring
*/
// Destructuring assignment
var [first, last] = ["Nikola", "Tesla"];
let {title, author} = { title: "The Silkworm", author: "R. Galbraith" };
// Available in loops too
for (let {title, artist} in songs) {
// ...
}
/*
* Spread