'How to send n axios post requests depending on number of elements in array

I have a params object:

const params = {price: '5000', qty: ''}

I have an array:

const sizes = [2, 3, 4, 5]

How can I make a params object for each element in the array and then use each object to make an axios request with number of requests depending on the number of elements in the array?

The array will vary. Sometimes it will have 4 or elements, or 10, or 20. I think the structure should look like the below sample, but it will vary depending on the size of the array.

   const [
     { data: data1 },
     { data: data2 },
     { data: data3 },
     { data: data4 },
   ] = await Promise.all([
     axios.post(url, params), // const params = {price: '5000', qty: '2'}
     axios.post(url, params), // const params = {price: '5000', qty: '3'}
     axios.post(url, params), // const params = {price: '5000', qty: '4'}
     axios.post(url, params), // const params = {price: '5000', qty: '5'}
   ])


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source