Last active
June 18, 2018 09:48
-
-
Save pastparty/454ee435f300fd5f70732dfe936c33ea to your computer and use it in GitHub Desktop.
Which Array Function When?
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
| /** | |
| * Return one thing for each existing thing | |
| */ | |
| arr.map((item, index) => {}) | |
| /** | |
| * Return only some of the existing things | |
| */ | |
| arr.filter((item, index) => {}) | |
| /** | |
| * Return only one new thing | |
| */ | |
| arr.reduce((accumulator, item, index) => {}) | |
| /** | |
| * Don't return anything, but do something with each existing thing | |
| */ | |
| arr.forEach((item, index) => {}) | |
| /** | |
| * @see https://www.codementor.io/andrew565/which-array-function-when-jbtnzytza | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment