Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Fibonacci Series Program. in javascript

<script>
//Fibonacci Series using Recursion
    let n = 9;
     
    // function returns the Fibonacci number
    function fib(n) {
    if (n <= 1)
        return n;
    return fib(n-1) + fib(n-2);
}
  
    //function call
    document.write(fib(n));
//This code is contributed by Surbhi Tyagi
</script>
 
PREVIOUS NEXT
Tagged: #Fibonacci #Series #javascript
ADD COMMENT
Topic
Name
4+5 =