Based on the Secrets of the Javascript Ninja Book