0 points

Search inside an array


dashboard

Posted 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_copy

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



>> Browse more code snippets

more_vert