I am trying to make a loop that fire every 3 seconds and trying to do so using Promises. I can't put a return
within the loop though like below so I don't know how to accomplish this.
for (let x = 0; x < 4; x++) {
return new Promise(resolve => {
setTimeout(() => {
console.log("timeout")
resolve()
}, 3000)
});
};