//构造缓存函数 var memoizer = function (memo, fundamental) { var shell = function (n) { var result = memo[n]; if (typeof result !== ‘number‘) { result = fundamental(shell, n); memo[n] = result; } return result; }; return shell; };
原文:http://www.cnblogs.com/ghgyj/p/4005382.html