Answers for "fibbonaci recursion js"

1

fibonacci recursion javascript

function fibonacci(n) {
    if (n < 2){
        return 1;
    }else{
        return fibonacci(n-2) + fibonacci(n-1);
    }
}

console.log(fibonacci(7));
//Returns 21
Posted by: Guest on June-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language