Skip to content

Instantly share code, notes, and snippets.

@IanRamosC
Last active August 29, 2015 14:16
Show Gist options
  • Save IanRamosC/77072b894d6617e528f3 to your computer and use it in GitHub Desktop.
Save IanRamosC/77072b894d6617e528f3 to your computer and use it in GitHub Desktop.
var fibonacci = function(val){
var res;
if(val === 0){
res = 0;
}else if(val === 1 || val === 2){
res = 1;
}else{
res = fibonacci(val - 1) + fibonacci(val - 2);
}
return res;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment