YAPC::EU 2018 Glasgow Update!

This commit is contained in:
Ingy döt Net 2018-08-17 15:15:24 +01:00
parent 22f33d4004
commit 4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions

View file

@ -0,0 +1,13 @@
Array.prototype.sleepSort = function(callback) {
const res = [];
for (let n of this)
setTimeout(() => {
res.push(n);
if (this.length === res.length)
callback(res);
}, n + 1);
return res;
};
[1, 9, 8, 7, 6, 5, 3, 4, 5, 2, 0].sleepSort(console.log);
// [ 1, 0, 2, 3, 4, 5, 5, 6, 7, 8, 9 ]