-
-
Save granmoe/dfca22636b08a72e8426fd7e1c795056 to your computer and use it in GitHub Desktop.
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
[1, 2, 3].map(x => x * 2) | |
// is equivalent to | |
reduce((accum, current) => [...accum, current * 2], [])([1, 2, 3]) | |
[1, 2, 3].filter(x => x > 2) | |
// is equivalent to | |
reduce((accum, current) => current > 2 ? [...accum, current] : accum, [])([1, 2, 3]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment