doc: add additional parameter to setTimeout/Interval section

This commit is contained in:
Leon Xu committed 2021-10-16 22:39:22 -07:00
1 parent 6b3d1ef460
commit a7cdded258
1 file changed
+14 -1
+14 -1
View File
@@ -114,4 +114,17 @@ function toggleMessageInterval() {
function sayHello() {
id("output-text").textContent += "Hello!";
}
```
```
# 向setTimeout/Interval传递附加参数
```javascript
function delayedMultiply() {
// 当计时器想起是,6和7被传递为乘法
setTimeout(multiply, 2000, 6, 7);
}
function multiply(a, b) {
alert(a * b);
}
```
延迟之后的任何参数最终都会传递给计时器函数