Skip to content

Instantly share code, notes, and snippets.

@ophentis
Created October 30, 2014 12:31
Show Gist options
  • Save ophentis/e6154aab2ecfaab3f813 to your computer and use it in GitHub Desktop.
Save ophentis/e6154aab2ecfaab3f813 to your computer and use it in GitHub Desktop.
recursive fabnacci with tail recurrsion
function fab(k) {
var m = arguments[1] = arguments[1] || 1,
n = arguments[2] = arguments[2] || 1
return k<=2 ? arguments[k] : f(k-1,n,m+n)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment