So I'm trying to console.log each value from a array, but with a delay after each log. It seems it's only waiting 3 seconds, than firing the code logging all at once. Is there any way I could simply log each one after 3 seconds each?
Here's my code:
//Dummy data
const CoordArray = new Array(7).fill(0).map((i, index) => ({XCoord:index, YCoord: index}))
CoordArray.forEach(function(CoordObject) {
//console.log(key, obj[key]);
setTimeout(function() {
console.log(CoordObject.XCoord + " " + CoordObject.YCoord);
}, 3000);
})