Skip to content

Instantly share code, notes, and snippets.

@tucq88
Created August 16, 2017 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tucq88/54db565b0d875450e75ccb4e9b223c0d to your computer and use it in GitHub Desktop.
Save tucq88/54db565b0d875450e75ccb4e9b223c0d to your computer and use it in GitHub Desktop.
Javascript Arrays Loop
  • Return one thing for each existing thing: map()
  • Return only some of the existing things: filter()
  • Return only one new thing: reduce()
  • Don't return anything, but do something with each existing thing: forEach()

Ref: https://dev.to/andrew565/which-array-function-when

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment