Skip to content

Instantly share code, notes, and snippets.

@negamorgan
Last active August 29, 2015 14:24
Show Gist options
  • Save negamorgan/87ec4d2a58223bcaced8 to your computer and use it in GitHub Desktop.
Save negamorgan/87ec4d2a58223bcaced8 to your computer and use it in GitHub Desktop.
ES2015 syntax notes
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