Skip to content

Instantly share code, notes, and snippets.

@bultas
Last active November 16, 2016 16:30
Show Gist options
  • Save bultas/d9fb5f42c3ef121706b1300d1fe337b7 to your computer and use it in GitHub Desktop.
Save bultas/d9fb5f42c3ef121706b1300d1fe337b7 to your computer and use it in GitHub Desktop.
ES6 Awesomeness (;
// DESTRUCTURING
// http://www.2ality.com/2015/01/es6-destructuring.html
let obj = { first: 'Jane', last: 'Doe' };
let { first: f, last } = obj;
// f = 'Jane'; last = 'Doe'
// Array FIND/FINDIndex
// https://davidwalsh.name/es6-features
let ages = [12, 19, 6, 4];
let firstAdult = ages.find(age => age >= 18); // 19
let firstAdultIndex = ages.findIndex(age => age >= 18); // 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment