0 works

Search inside an array


dashboard+ Project

Posted by @starbucks #javascript #nodejs

Code snippet:

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 to Clipboard

More details:

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


>> Browse more code snippets

more_vert