Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement