Given
const list = [1,2,3,4,5,6,7];
let results = [];
and a function
powerNumPlusOne = async(num) : Promise<any> => {
return powerNum*powerNum + 1;
}
how to make sure this code work
list.forEach(async function(i){
results.push( await this.powerNumPlusOne(i));
})
and the results
should be [2,5,10,17,26,37,50]
in order?