代码有问题是因为在调用 setInterval() 方法时,应该传递函数名 aaa 而不是调用函数 aaa()。应该修改为以下代码:

let times;
function aaa() {
  console.log(1);
}
times = setInterval(aaa, 1);

这样就能正确地设置定时器,并且每隔 1 毫秒就调用函数 aaa 一次。

let times function aaa consolelog1; times = setIntervalaaa 1 为什么有问题

原文地址: https://www.cveoy.top/t/topic/inCm 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录