gpt4 book ai didi

javascript - 如何退出 setInterval

转载 作者:IT王子 更新时间:2023-10-29 03:00:05 27 4
gpt4 key购买 nike

如果条件正确,我需要退出运行间隔:

var refreshId = setInterval(function() {
var properID = CheckReload();
if (properID > 0) {
<--- exit from the loop--->
}
}, 10000);

最佳答案

使用clearInterval :

var refreshId = setInterval(function() {
var properID = CheckReload();
if (properID > 0) {
clearInterval(refreshId);
}
}, 10000);

关于javascript - 如何退出 setInterval,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1795100/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com