Write a recursive function called `fibonacci` that takes an integer, `n`, and returns the `n`th number in the Fibonacci sequence. Not familiar with the Fibonacci sequence? Beginning with 0 and 1, we add the two previous numbers in the sequence together to form the next one: 0, 1, 1, 2, 3, 5, 8, et
(n)
| 89 | ***********************************************************************/ |
| 90 | |
| 91 | function fibonacci(n){ |
| 92 | |
| 93 | if (n === 1 || n === 2) return 1; |
| 94 | |
| 95 | return fibonacci(n - 1) + fibonacci(n - 2) |
| 96 | |
| 97 | } |
| 98 | |
| 99 | |
| 100 | // console.log(fibonacci(1)); // 1 |
nothing calls this directly
no outgoing calls
no test coverage detected