I am totally new to the concept of promises and asynchronous programming and have a hard time wrapping my mind this setTimeout() function why this would work: it would console.log() every
time i increments.
let i = 1;
setTimeout(function run() {
console.log(i);
i++;
setTimeout(run, 1000);
}, 1000);
while console.log() a different value would just console.log() once.
setTimeout(function run() {
console.log(".");
i++;
setTimeout(run, 1000);
}, 1000);
Can someone help explain the logic behind this? Thanks.