The all true and really funny fronteers10 talk of Jake Archibald (former BBC employee now working in The Team). He talked about how to manage and build an Javascript API.
The all true and really funny fronteers10 talk of Jake Archibald (former BBC employee now working in The Team). He talked about how to manage and build an Javascript API.
var shuffle = function(arr) {
var result = [],
arr = arr.slice(); // make sure, we don’t destroy original array
while(arr.length) {
result.push(arr.splice(Math.floor(Math.random()*arr.length), 1)[0]);
}
return result;
}
This is the fastest implementation of an array shuffle method I came up with so far and it only uses 0.012 milleseconds per ten items in an array on my machine with firefox. And because it does this iterative and has an complexity of O(n) it takes 1.2 milliseconds shuffling an array with 1000 items. Does anyone have an idea to improve it more?
The modules convention of node.js (orignating in CommonJS) seems strange at first. But finally I got Dean Edwards’ Base to work. The modules system finally starts to make sense to me and I’m now able to write object oriented code within Node.js. Yaayyyy!
Just stumble upon an old link that demonstrates what is possible with javascript and canvas. Beautiful and inspiring. Javascript is almost ready for gaming experiences (if we get rid of that nasty Internet Explorer)