Skip to content

Instantly share code, notes, and snippets.

@TheMagoo73
Created May 31, 2018 09:06
Show Gist options
  • Save TheMagoo73/4a47643f85994890cd5afaf63c8d0ba2 to your computer and use it in GitHub Desktop.
Save TheMagoo73/4a47643f85994890cd5afaf63c8d0ba2 to your computer and use it in GitHub Desktop.
A quick demo of the filter higher-order function in JavaScript
var data = ["fred", "ann", "bob", "nina"];
console.log("Original data: ")
data.forEach(d => console.log(d));
data = data.filter(d => d.includes("a"));
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