I want to make a for loop wait for a setTimeout
before moving on to the next interaction. I tried this but it doesn't work.
async function loadNotes(request) {
for (let i = 0; i < 100; i++) {
let saludo;
setTimeout(function() {
saludo = "hola";
}, 2000)
console.log(await saludo);
console.log(i)
}
}
loadNotes();
For that you just have to place your code inside a promise.