Обещание рекурсивного установки
function recursiveSetTimeout(iterations) {
return new Promise((resolve, reject) => {
function repeat(count) {
if (!count) return resolve("finished")
console.log(count)
setTimeout(repeat.bind(null, count-1), 300)
}
repeat(iterations)
})
}
recursiveSetTimeout(3).then((result)=>{console.log(result)})
SubZ390