Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Filter example 3
// 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
You can’t perform that action at this time.