I have a function and a loop:
var songs = Musics.searchSongs(query).then(function(rs) {
   return rs;
  });
  for (var i = 0; i < songs.length; i++) {
   console.log(songs[i]);
  }
Now I want to run the loop with the result that taken from after executing the function. How can I do that?
 
    