Last active
November 28, 2015 14:40
-
-
Save dd1994/60943d59b2d88317e9d0 to your computer and use it in GitHub Desktop.
an example of setTimeout and clearTimeout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
let timeoutID1 = setTimeout(function(arg1, arg2) { | |
console.log(arg1) | |
console.log(arg2) | |
}, 2000, 'hello1', 'go1') | |
let timeoutID2 = setTimeout(function(arg1, arg2) { | |
console.log(arg1) | |
console.log(arg2) | |
}, 2000, 'hello2', 'go2') | |
// timeoutID is a number in broswer,but a complex object in node.js | |
console.log(timeoutID1, timeoutID2) | |
clearTimeout(timeoutID2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment