Created
February 14, 2018 11:10
-
-
Save JoaoCnh/e8fdd2543c747907363eff4550ccbda1 to your computer and use it in GitHub Desktop.
Filter example 3
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
// using the songs array from previous examples | |
var mastodonSongs = songs.filter(function (song) { | |
return song.artist.toLowerCase() === "mastodon"; | |
}); | |
// ES6 | |
const mastodonSongs = songs.filter(song => { | |
return song.artist.toLowerCase() === "mastodon"; | |
}); | |
console.log(mastodonSongs); | |
// [{ | |
// id: 1, | |
// name: "Curl of the Burl", | |
// artist: "Mastodon", | |
// }, | |
// { | |
// id: 2, | |
// name: "Oblivion", | |
// artist: "Mastodon", | |
// }] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment