Skip to content

Instantly share code, notes, and snippets.

@JoaoCnh
Created February 14, 2018 11:06
Show Gist options
  • Save JoaoCnh/695936692866f60d9cc2c16d74ba3696 to your computer and use it in GitHub Desktop.
Save JoaoCnh/695936692866f60d9cc2c16d74ba3696 to your computer and use it in GitHub Desktop.
Filter example 2
var strings = ["hello", "Matt", "Mastodon", "Cat", "Dog"];
var filtered = strings.filter(function (str) {
return str.includes("at");
});
// ES6
const filtered = strings.filter(str => {
return str.includes("at");
});
console.log(filtered); // ["Matt", "Cat"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment