var a=0;
var timer=setTimeout(function(){
a++;
},1000);
if(a>0){
alert("1");
}
I clearly changed the value of a in this code in the timer, why is the output still 0?
How should I write to make this pop-up window pop up? (Based on making the judgment effective. )
The execution sequence you imagined
Actual execution sequence
There are many ways to get this a=1, but you don’t know the meaning here, what is it for.
If you have additional questions, please put them in the question, not in the comments of the question.