Created
April 18, 2018 09:18
-
-
Save gladchinda/ce0d0ecec8f3cb016242e4123cc945bc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const rainbow = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']; | |
// Assign the first and third items to red and yellow | |
// Assign the remaining items to otherColors variable using the spread operator(...) | |
const [red,, yellow, ...otherColors] = rainbow; | |
console.log(otherColors); // ['green', 'blue', 'indigo', 'violet'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment