Please help me with this problem. After each loop occurance, I wanted to log data with an increase in seconds.
my result (logs data just after 1 second)
for(let i=1;i<=3;i++){
setTimeout(() => {
console.log(i) // this logs after each second
},i*1000)
}
expected result :
- after 1 second - print - console.log(1)
- after 2 second - print - console.log(2)
- after 3 second - print - console.log(3)