Suppose you have
const list = [1,2,3,4,5,6,7];
let results = [];
as well as a function
powerNumPlusOne = async(num) : Promise<any> => {
return powerNum*powerNum + 1;
}
What steps can be taken to ensure that this code functions appropriately?
list.forEach(async function(i){
results.push( await this.powerNumPlusOne(i));
})
In the end, the results
should be [2,5,10,17,26,37,50]
in a specific sequence.