Skip to content

Instantly share code, notes, and snippets.

@TheMagoo73
Created May 31, 2018 08:57
Show Gist options
  • Save TheMagoo73/016121001d009fd5451cdfe9d67c1053 to your computer and use it in GitHub Desktop.
Save TheMagoo73/016121001d009fd5451cdfe9d67c1053 to your computer and use it in GitHub Desktop.
A quick demo of the forEach and map higher-order functions in JS
var data = ["fred", "ann", "bob", "nina"];
console.log("Original data: ")
data.forEach(d => console.log(d));
data = data.map(d => "test-" + d);
console.log("Updated data: ")
data.forEach(d => console.log(d));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment