Here you can find the source of concatAll()
// https://egghead.io/lessons/javascript-create-an-array-concatall-method const exchanges= [/* www .ja v a 2s. c o m*/ [ {symbol: 'XFX', price: 240.22, volume: 23432}, {symbol: 'TNZ', price: 332.19, volume: 234}, ], [ {symbol: 'JXJ', price: 120.22, volume: 5323}, {symbol: 'NYN', price: 88.47, volume: 98275}, ], ] console.log('\nVIDEO 05') exchanges.forEach(exchange => exchange.forEach(stock => console.log(stock))) Array.prototype.concatAll= function() { let results= [] this.forEach(subArray => subArray.forEach(item => results.push(item))) return results } exchanges .concatAll() .forEach(stock => console.log(stock))
Array.prototype.concatAll = function() { var results = []; this.forEach(function(subArray) { subArray.forEach(function(element){ results.push(element); }); }); return results; }; ...
let exchanges = [ [ { symbol: 'XFX', price: 240.22, volume: 23432 }, { symbol: 'TNZ', price: 332.19, volume: 234 }, ], [ { symbol: 'JXJ', price: 120.22, volume: 5323 }, { symbol: 'NYN', price: 88.47, volume: 98275 }, ], ...
var exchanges = [ [ {symbol: "XFZ", price: 340.22, volume: 202373}, {symbol: "ABC", price: 521.19, volume: 737323} ], [ {symbol: "DEF", price: 987.82, volume: 2373}, {symbol: "HIJ", price: 200.82, volume: 373} ] ...
Array.prototype.concatAll = function() { var results = []; this.forEach(function(subArray) { results.push.apply(results, subArray); }); return results; };
Array.prototype.concatAll = function() { var results = []; this.forEach( subArray => { subArray.forEach(elt => results.push(elt)); }); return results; };
Array.prototype.concatAll = function() { var results = []; this.forEach(function(subArray) { subArray.forEach(function(item) { results.push(item); }); }); return results; }; ...
Array.prototype.concatAll = function() { var results = []; this.forEach(function(subArray) { results.push.apply(results, subArray); }); return results; };
Array.prototype.concatAll = function() { this.forEach( function(val1) { val1.forEach( function (val2) { return allWords.push(val2); }); }); };
var exchanges = [ [ { symbol: "XFX", price: 240.22, volume: 23432 }, { symbol: "TNZ", price: 332.19, volume: 234 } ], [ { symbol: "JXJ", price: 120.22, volume: 5323 }, { symbol: "NYN", price: 88.47, volume: 98275 } ] ...