Created
January 4, 2016 22:47
-
-
Save ghostbar/81cb47ac4a03a6140a40 to your computer and use it in GitHub Desktop.
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
var timeoutIds = [] | |
function newTimeout (fn, time) { | |
return setTimeout(fn, time) | |
} | |
function toBeSent () { | |
console.log('I\'m being called! Timeout!', Date.now()) | |
console.log(timeoutIds) | |
} | |
function theCall () { | |
for (var i=0; i < 2; ++i) { | |
var rand = Math.floor(Math.random() * (3000 - 200)) + 200 | |
timeoutIds.push(newTimeout(toBeSent, rand)) | |
} | |
} | |
theCall() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment