Files
JavaScript/Recursive/FibonacciNumberRecursive.js
Umesh Patidar 6debd5c1a2 chore: 🤖 remove extra lines (#1330)
I ran the command yarn style and that got failed, so I fixed that
2023-06-17 01:49:21 +05:30

17 lines
388 B
JavaScript

/**
* @function Fibonacci
* @description Function to return the N-th Fibonacci number.
* @param {Integer} n - The input integer
* @return {Integer} - Return the N-th Fibonacci number
* @see [Fibonacci](https://en.wikipedia.org/wiki/Fibonacci_number)
*/
const fibonacci = (n) => {
if (n < 2) {
return n
}
return fibonacci(n - 2) + fibonacci(n - 1)
}
export { fibonacci }