【发布时间】:2022-01-05 10:42:21
【问题描述】:
我有以下代码,我试图在 setInterval 中使用一个函数,但它不起作用......我做错了什么?
const job = schedule.scheduleJob({ hour: 01, minute: 56 }, () => {
loop();
});
function loop() {
var checkminutes = 5,
checkthe_interval = checkminutes * 60 * 1000;
var i = 0;
var interval = setInterval(() => {
i++;
console.log(i); // Just trying here to see if the i value gets printed in console.. but nope..
//uploadFile();
}, checkthe_interval);
}
【问题讨论】:
-
欢迎来到 Stack Overflow!当你说它不起作用时,你能否进一步澄清你的意思?结果如何?
-
它不会在控制台中打印值 i,它实际上会跳过该部分
-
请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
-
idk 是否可行,但请尝试将 checkthe_interval 变量替换为
6960000