Skip to content

Instantly share code, notes, and snippets.

@micheleriva
Last active February 17, 2019 18:03
Show Gist options
  • Save micheleriva/8fe65ee1f7120519283ae27cebc0cfca to your computer and use it in GitHub Desktop.
Save micheleriva/8fe65ee1f7120519283ae27cebc0cfca to your computer and use it in GitHub Desktop.
const integers = [1, 2, 3, 4, 5].map((item) => item * 2);
// [2, 4, 6, 8, 10]
const strings = ["one", "two", "three"].map((item, index) => `${index + 1} ${item}`)
// ["1 one", "2 two", "3 three"]
const mixedTypes = [undefined, null, "foo", 123, NaN, Symbol].map((item) => typeof item)
// ["undefined", "object", "string", "number", "number", "function"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment