Last active
August 29, 2015 14:24
-
-
Save negamorgan/87ec4d2a58223bcaced8 to your computer and use it in GitHub Desktop.
ES2015 syntax notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let articles = [ | |
| { | |
| body: 'lorem ipsum dolor sit amet', | |
| title: 'i love articles' | |
| }, | |
| { | |
| body: 'lorem ipsum', | |
| title: 'stuff and things' | |
| }, | |
| { | |
| body: 'lorem ipsum dolor sit amet', | |
| title: 'best article' | |
| }]; | |
| var printArticle = function(obj){ | |
| let {title: t, body: b} = obj; | |
| console.log(t + '\n' + b + '\n'); | |
| }; | |
| let [featured, ...remaining] = articles; | |
| printArticle(featured); | |
| console.log('---------------------------'); | |
| remaining.forEach(a => printArticle(a)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment