Skip to content

Instantly share code, notes, and snippets.

@matthew-gerstman
Created March 18, 2019 22:18
Show Gist options
  • Save matthew-gerstman/6ec04a34ba7d97df3e8f9677c20fe9e5 to your computer and use it in GitHub Desktop.
Save matthew-gerstman/6ec04a34ba7d97df3e8f9677c20fe9e5 to your computer and use it in GitHub Desktop.
function filter(list, predicate) {
return list.reduce((acc, item) => {
if (predicate(item)) {
acc.push(item);
}
return acc;
}, []);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment