Memoization and recursive functions in JavaScript
codeanarchy.org