I am looping through array of items and running a setTimeOut which contains a certain function for each coin. If I want to successfully run the function before moving onto the next coin, do I need to put async/await on the setTimeout and the function inside the timeout? In order for the function to fully finish before moving onto the next coin?
coins.forEach((coin) => {
console.log('looping for each coin', coin);
const filteredTimeLeft = coin.timeLeft
.replace(/[()]/g, "")
.split(" ")
.filter((word) => word !== "Pacific" && word !== "Time")
.join(" ");
let endTime = moment(new Date(filteredTimeLeft)).unix();
const convertSec = Number(coin.seconds);
const calcTime = endTime - convertSec - moment().unix();
console.log(calcTime);
setTimeout(() => {
// placeBid(coin, username, password)
placeAutomaticBid();
// placeTest()
}, calcTime * 1000);
});