How do I wrap axios.get multiple response results into one array?

How do I wrap axios.get multiple response results into one array?

Hi I am trying to combine the results of my axios get request into one array.

Hi I am trying to combine the results of my axios get request into one array.

I am grabbing data from Mongoose and MongoDB database which returns me an array of relevant information for the axios request to run through

I run the info through axios.get and it returns me with respective results for each object in the array

See below

const axios = require("axios");

var info = [500000, 2020, 12341234, 12341234] var algo = "cn8"


for (var i = 0; i < info.length; i++){

var url = "" + algo + "=true" + "&factor%5B" + algo + "_hr%5D=" + info[i]

axios.get(url) .then((response) => { var result =



However I am also trying to write this result back into my MongoDB/Mongoose database for further logging and someone suggested I can use the map function to run the write functions going back into the database for it.

However map only works for arrays and the results I am getting from axios are not. Does anyone have any idea how to join these response I am getting into one array?

I have attached a picture below for reference

Keep in mind these are the results for console.log(info) is in GREEN for data going in

console.log(result) is in RED for data supposed to be going out (need to transform into combined array first, not sure how to do when all the results are in one variable)

javascript arrays mongodb

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Learn Arrays And Array Methods in JavaScript

In JavaScript, an array is a data structure that contains list of elements which store multiple values in a single variable. The strength of JavaScript arrays lies in the array methods. Array methods are functions built-in to JavaScript that we can apply to our arrays — Each method has a unique function that performs a change or calculation to our array and saves us from writing common functions from scratch. In this video we are going to learn arrays and array methods like sort(), reverse(), join(), split(), pop(), push(), shift(), unshift(), toString(), delete array, etc.......

Javascript Clear Array: How to Empty Array in Javascript

To clear array in Javascript, Substituting an existing array with a new array.Setting an array length prop to 0.Splice the whole array.

Convert String To Array Using Javascript Split Method

In this tutorial, you’ll be going to learn how to convert string to array using javascript split method. The easiest approach to use javascript built-in method String.split(). JavaScript split string method return array of a substring after splitting a string based on the separator you provide. The separator might be a string, special character or […]

JavaScript 2D Array: Create Two Dimensional Array in JavaScript

To create a 2D array in JavaScript, we have to create an array of array. To declare a 2D array, use the same syntax as declaring a 1D array.

How To Loop Through An Array In JavaScript

In this tutorial, you'll be going to learn how to loop through an array in javascript. The easiest way to use for loop and forEach array method.