Last active
April 17, 2017 03:50
-
-
Save nattatorn-dev/04994441745385c6a0992b5bc2f4b58d 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
Head & Tail | |
Destructuring syntax allows us to get the head and tail of a list without utility functions. | |
_.head([1, 2, 3]); | |
// 1 | |
_.tail([1, 2, 3]); | |
// [2, 3] | |
// becomes | |
const [head, ...tail] = [1, 2, 3]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment