Nodejs Utililty Methods Array Concatenate

List of utility methods to do Array Concatenate

Description

The list of methods to do Array Concatenate are organized into topic(s).

Method

concatAll()
const 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},
  ],
...
concatAll()
Array.prototype.concatAll = function() {
  var results = [];
  this.forEach(function(subArray) {
    subArray.forEach(function(item) {
      results.push(item);
    });
  });
  return results;
};
...
concatAll()
Array.prototype.concatAll = function() {
  var results = [];
  this.forEach(function(subArray) {
    results.push.apply(results, subArray);
  });
  return results;
};
concatAll()
Array.prototype.concatAll = function() {
    this.forEach( function(val1) {
        val1.forEach( function (val2) {
                return allWords.push(val2);
        });
    });
};
concatAll()
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 }
    ]
...
concatAll()
Array.prototype.concatAll = function() {
  var results = [];
  this.forEach(function(subArray) {
    subArray.forEach(function(item) {
      results.push(item);
    });
  });
  return result;