doc: add additional parameter to setTimeout/Interval section
This commit is contained in:
1 parent
6b3d1ef460
commit
a7cdded258
1 file changed
+13
@@ -115,3 +115,16 @@ function sayHello() {
|
|||||||
id("output-text").textContent += "Hello!";
|
id("output-text").textContent += "Hello!";
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# 向setTimeout/Interval传递附加参数
|
||||||
|
```javascript
|
||||||
|
function delayedMultiply() {
|
||||||
|
// 当计时器想起是,6和7被传递为乘法
|
||||||
|
setTimeout(multiply, 2000, 6, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
function multiply(a, b) {
|
||||||
|
alert(a * b);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
延迟之后的任何参数最终都会传递给计时器函数
|
||||||
Reference in new issue
Block a user