Search inside an array

PHOTO EMBED

Saved by [deleted user] #javascript #nodejs

const songs[];
const results;

for (var i, i++, i<songs.length){
    if(song[i].artist == "Drake"){
      result.push(songs[i]);
    };

// OR

const songs [];
const result = songs.filter ( song => song.artist == "Drake");
content_copyCOPY

Example on a "songs" array that holds artist information.