Skip to content

Instantly share code, notes, and snippets.

@kshimi
Last active August 3, 2016 05:27
Show Gist options
  • Save kshimi/eb74f7c26c2d16762560 to your computer and use it in GitHub Desktop.
Save kshimi/eb74f7c26c2d16762560 to your computer and use it in GitHub Desktop.
JavaScriptによるフィボナッチ数列再帰版
// fibonacci number
alert(
(function(n) // nameless function 1
{ // nameless function1 body
return "1," + (f = function(a, b, n) // nameless function 2
{ // nameless function2 body
if (n == 0 )
{
return "";
}
return a + "," + f(a+b, a, n-1);
}
) (1, 1, n); // inline function call 2
}
) (100) // inline function call 1
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment