Created
February 14, 2018 11:06
-
-
Save JoaoCnh/695936692866f60d9cc2c16d74ba3696 to your computer and use it in GitHub Desktop.
Filter example 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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