Skip to content

Instantly share code, notes, and snippets.

@indongyoo
Last active April 3, 2018 12:15
Show Gist options
  • Save indongyoo/687926acfe994310845b396893498fdd to your computer and use it in GitHub Desktop.
Save indongyoo/687926acfe994310845b396893498fdd to your computer and use it in GitHub Desktop.
// Iterator 2
console.log(
map(
([key, val]) => [key.toUpperCase(), val + 1],
new Map([['a', 1], ['b', 2]]).entries())
);
// [["A", 2], ["B", 3]]
console.log(
new Map(map(
([key, val]) => [key.toUpperCase(), val + 1],
new Map([['c', 3], ['d', 4]]).entries()))
);
// Map(2) {"C" => 4, "D" => 5}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment