Web Workers in 5 Minutes

main.js worker = new Worker('worker.js'); worker.addEventListener('message', function(e){ console.log(e.data); }, false); worker.postMessage(2); Create a new instance of the Worker class, which is »

Binary "Arrays" with Bitwise Operators

Have an array of 32 or fewer binary values? Improve your speed and space consumption with this one weird trick! »

Fast Powers of 2

1 << n is logically equivilent to Math.pow(2,n), and performs slightly faster, plus it looks cool. It's a small optimization, but something you might consider when »

Basic N-Queens Solution

The n-queens puzzle asks: for any given number n, how many many ways can you place n queens on an n x n chessboard. People have explored the n-queens problem »