Skip to content

Commit 6b59726

Browse files
authored
Create fibonacci.js
A recursive implementation for generating a Fibonacci Sequence of certain length.
1 parent ffe21c8 commit 6b59726

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Fibonacci Sequence/fibonacci.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Recursive implementation
2+
export default function fibonacci(length) {
3+
if (length <= 1) return 1;
4+
5+
return fibonacci(length - 1) + fibonacci(length - 2);
6+
}

0 commit comments

Comments
 (0)