diff --git a/source/_posts/Timing.md b/source/_posts/Timing.md index b00d5b3..030e69b 100644 --- a/source/_posts/Timing.md +++ b/source/_posts/Timing.md @@ -114,4 +114,17 @@ function toggleMessageInterval() { function sayHello() { id("output-text").textContent += "Hello!"; } -``` \ No newline at end of file +``` + +# 向setTimeout/Interval传递附加参数 +```javascript +function delayedMultiply() { + // 当计时器想起是,6和7被传递为乘法 + setTimeout(multiply, 2000, 6, 7); +} + +function multiply(a, b) { + alert(a * b); +} +``` +延迟之后的任何参数最终都会传递给计时器函数 \ No newline at end of file