Created
October 19, 2014 11:53
-
-
Save florian/01c59eb660b99b07036a to your computer and use it in GitHub Desktop.
JavaScript sleepsort
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
function sleepsort (A) { | |
A.forEach(function (v) { | |
setTimeout(function (v) { | |
return function () { | |
console.log(v); | |
} | |
}(v), v); | |
}); | |
} | |
sleepsort([5,2,3,4]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment