From fca8924f2f18fd2cc50b76e36c4d3404bfad6ba9 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Fri, 6 Feb 2015 17:42:04 +0800 Subject: [PATCH] Destructuring isn't in io.js yet --- es6.md | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/es6.md b/es6.md index 269546bcf..8bd0d083c 100644 --- a/es6.md +++ b/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