Skip to content

Instantly share code, notes, and snippets.

@terakilobyte
Created April 18, 2015 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terakilobyte/512fb77f90087565c6c5 to your computer and use it in GitHub Desktop.
Save terakilobyte/512fb77f90087565c6c5 to your computer and use it in GitHub Desktop.
FEM async
Array.prototype.concatAll = function() {
var results = [];
this.forEach(subArray => {
subArray.forEach(item => {
results.push(item);
});
// ------------ INSERT CODE HERE! ----------------------------
// Add all the items in each subArray to the results array.
// ------------ INSERT CODE HERE! ----------------------------
});
return results;
};
/*
return movieLists.map(function(genre) {
return genre.videos.map(function(video) {
return video.id;
});
}).concatAll();
*/
// I stupidly left out a paren
return movieLists.map(genre => genre.videos.map(video => video.id)).concatAll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment