Answers for "fibonacci series in js using recursion"

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 "fibonacci series in js using recursion"

Code answers related to "Javascript"

Browse Popular Code Answers by Language