Skip to content

Instantly share code, notes, and snippets.

@icodejs
Created April 8, 2019 14:26
Show Gist options
  • Save icodejs/d36778a0c1b5929c65c41c3e7784d444 to your computer and use it in GitHub Desktop.
Save icodejs/d36778a0c1b5929c65c41c3e7784d444 to your computer and use it in GitHub Desktop.
Get first and last elements in array, ES6 way
let {0 : a ,length : l, [l - 1] : b} = [1,2,3,4,5,6,7,8,9,0];
console.log(a, b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment