Вам необходимо использовать функцию Promise.all
, где вы помещаете свой массив обещаний
var array1 = [1, 4, 9, 16];
// pass a function to map
const test = async () => {
const map1 = await Promise.all(array1.map(async x => 'hi'));
return map1;
}
test().then((data) => {
console.log(data)
});
ожидаемый вывод: Array ['hi', 'hi', 'hi', 'hi']
blockquote>