Skip to content

Instantly share code, notes, and snippets.

@MichaelQQ
Created June 9, 2016 16:00
Show Gist options
  • Save MichaelQQ/4d0d89f645c14ebece139b499c69d025 to your computer and use it in GitHub Desktop.
Save MichaelQQ/4d0d89f645c14ebece139b499c69d025 to your computer and use it in GitHub Desktop.
const afib = f => n => {
if (n < 2) {
return 1;
}
return f(n -1) + f(n - 2);
}
//or
const afib = f => n => n < 2 ? 1 : f(n - 1) + f(n - 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment