Created
April 8, 2019 14:26
-
-
Save icodejs/d36778a0c1b5929c65c41c3e7784d444 to your computer and use it in GitHub Desktop.
Get first and last elements in array, ES6 way
This file contains 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 {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