function helloSayer(times, name) {
return new Promise((resolve, reject) => {
let counter = 0;
let id = setInterval(() => {
counter++;
console.log(name);
if (counter == times) {
clearInterval(id);
resolve();
}
}, 100);
});
}
helloSayer(3, “Prateek”).then(helloSayer(3, “Arnav”));
Why this code not printing serially?
Can you share your code via fiddle please