Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

fibonacci series with recursion in javascript

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

console.log(fibonacci(7));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #fibonacci #series #recursion #javascript
ADD COMMENT
Topic
Name
2+9 =