Created
August 12, 2012 07:42
-
-
Save EvanHahn/3330517 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
// JavaScript sleepsort | |
// by Evan Hahn (evanhahn.com) | |
// Port of this genius on 4chan: | |
// http://dis.4chan.org/read/prog/1295544154 | |
// Call it like this: | |
// sleepsort(5, 4, 12, 8, 9, 10, 240); | |
function sleepsort() { | |
var i = arguments.length; | |
while (i --) { | |
setTimeout(function(n) { | |
console.log(n); | |
}, i, arguments[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment