Skip to content

Instantly share code, notes, and snippets.

View rk's full-sized avatar
🤠
Wranglin' private repo's

Robert K rk

🤠
Wranglin' private repo's
View GitHub Profile
@rk
rk / fib.js
Created October 3, 2011 13:07
Cached fibonacci
var http = require('http');
function fib(n){
if (n < 2) return 1;
else return fib(n-2) + fib(n-1);
}
var cached_fib = (function(){
var cache = {};
return function(n) {