Say I have a for loop inside a function like this:
function test() {
for(let i = 0; i < 10; i++) {
console.log(i) ;
};
return;
};
This works, but the function returns before the for loop is done. How do I make it wait until the for loop is done to return?
I have tried using deffrent combonations of awaits andpromisesand searched a lot on Google, but have not found anything.