Last active
March 31, 2016 20:13
-
-
Save cmoody/2f8ed4a02490192a5a5d47d1589f785b to your computer and use it in GitHub Desktop.
Array Destructuring
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
// Array destructure | |
let arr = [9, 8, 7, 6, 5, 4, 3, 2, 1]; | |
let [a, b, ...numbers] = arr; | |
console.log(a); // returns 9 | |
console.log(b); // returns 8 | |
console.log(numbers); // returns [7, 6, 5, 4, 3, 2, 1]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment