Code:
var x=0;
for(let i=0; i<5; i++){
setTimeout(()=>{
x++;
console.log(x);
}, 1000);
}
Output:
1
2
3
4
5Sage
Your BloggerSpace assistant
Hi! I'm Sage, your BloggerSpace assistant. Ask me to find blogs, recommend topics, or explain how the platform works — I'll pull live data and share clickable links.
Powered by Gemini · may occasionally be wrong
Code:
var x=0;
for(let i=0; i<5; i++){
setTimeout(()=>{
x++;
console.log(x);
}, 1000);
}
Output:
1
2
3
4
5BloggerSpace author · 1 follower