Created
March 28, 2019 02:59
-
-
Save rcdexta/baa3e2e6c99819fea0b069d7de82c021 to your computer and use it in GitHub Desktop.
first and rest
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 names = ["first", "middle", "last", "suffix"] | |
const firstName = _.first(names) | |
const otherNames = _.rest(names) | |
const [firstName, ...otherNames] = names | |
console.log(firstName) // 'first' | |
console.log(otherNames) // [ 'middle', 'last', 'suffix' ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment