当前位置:网站首页>Functions in setinterval cannot have parentheses
Functions in setinterval cannot have parentheses
2022-06-24 07:02:00 【Haitian Eagle】
while The cycle will get stuck CPU, To use setInterval Instead of .
Only once
<script>
var i=0;
function say() {
i++;
document.write(i+'<br>');
if (i==10)
clearInterval(id);
}
var id = setInterval(say(), 100);
</script>Change to
<script>
var i=0;
function say() {
i++;
document.write(i+'<br>');
if (i==10)
clearInterval(id);
}
var id = setInterval(say, 100);
</script>setInterval Method is executed only once after the parameter is extracted
边栏推荐
- leetcode:剑指 Offer 26:判断t1中是否含有t2的全部拓扑结构
- RS485 serial port wiring description of smart lamp post smart gateway
- 目标5000万日活,Pwnk欲打造下一代年轻人的“迪士尼乐园”
- 智能视觉组A4纸识别样例
- How to register the cloud service platform and what are the advantages of cloud server
- On BOM and DOM (4): dom0/dom2 event handling analysis
- Game website making tutorial and correct view of games
- Virtual file system
- Typora收费?搭建VS Code MarkDown写作环境
- Multi sensor fusion track fusion
猜你喜欢

leetcode:剑指 Offer 26:判断t1中是否含有t2的全部拓扑结构

Spark项目打包优化实践

原神方石机关解密

FreeRTOS MPU makes the system more robust!

Record -- about the method of adding report control to virtual studio2017 -- reportview control

C语言学生管理系统——可检查用户输入合法性,双向带头循环链表

Challenges brought by maker education to teacher development

成为 TD Hero,做用技术改变世界的超级英雄 | 来自 TDengine 社区的邀请函

Typora charges? Build vs Code markdown writing environment

缓存操作rockscache原理图
随机推荐
Overview of cloud computing advantages of using cloud computing
机器人迷雾之算力与智能
Oceanus kudu sink summary
云监控系统 HertzBeat v1.1.0 发布,一条命令开启监控之旅!
Deploy DNS server using dnsmasq
项目Demo
网吧管理系统与数据库
云上本地化运营,东非第一大电商平台Kilimall的出海经
Le système de surveillance du nuage hertzbeat v1.1.0 a été publié, une commande pour démarrer le voyage de surveillance!
Rockscache schematic diagram of cache operation
Interpreting top-level design of AI robot industry development
What is the OSI seven layer model? What is the role of each layer?
decade
【云驻共创】华为云HCIA-IoT V2.5培训系列内容之物联网概览
.NET7之MiniAPI(特别篇) :Preview5优化了JWT验证(上)
Go excel export tool encapsulation
[Yugong series] June 2022 asp Basic introduction and use of cellreport reporting tool under net core
Multi sensor fusion track fusion
Application of intelligent reservoir management based on 3D GIS system
Spark parameter tuning practice
https://jingyan.baidu.com/article/b2c186c86c3590c46ef6ffe5.html