亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - Problem with variable assignment in timer
過去多啦不再A夢
過去多啦不再A夢 2017-05-19 10:34:41
0
1
619
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. )

過去多啦不再A夢
過去多啦不再A夢

reply all(1)
伊謝爾倫

The execution sequence you imagined

var a = 0;
a++;
console.log(a);

Actual execution sequence

var a = 0;
console.log(a);
delay 1 second ……
a++;

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template