const ids = [1, 2, 3] const resArr = [] // 1 ids.forEach(id => api(id).then(res => resArr.push(res)) // 2 Promise.all(ids.map(id => api(id).then(res => resArr.push(res))))