Destructuring isn't in io.js yet
This commit is contained in:
parent
f7d88ba0de
commit
fca8924f2f
27
es6.md
27
es6.md
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue