Created
December 23, 2014 17:12
-
-
Save mrlannigan/68cfb40aa9514239a019 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var timer; | |
timer = setTimeout(function () {console.log('first timer'); timeoutRun()}, 1000); | |
timer = setTimeout(function () {console.log('second timer'); timeoutRun()}, 1000); | |
clearTimeout(timer); | |
function timeoutRun() { | |
console.log('Timed out!'); | |
} |
This file contains hidden or 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
var timer; | |
timer = setTimeout(createTimeoutRun('first'), 1000); | |
timer = setTimeout(createTimeoutRun('second'), 1000); | |
clearTimeout(timer); | |
function createTimeoutRun(text) { | |
return function () { | |
console.log(text + ' timer Timed out!'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment