Skip to content

Commit a145b27

Browse files
author
munnaSorder
committed
add
1 parent 78797fd commit a145b27

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

recursion.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function recursiveFibo(num) {
2+
if (num == 0){
3+
return [1]
4+
}
5+
if (num == 1) {
6+
return [1,1]
7+
}
8+
var fibo = recursiveFibo(num - 1)
9+
var newFibo = fibo[num - 1] + fibo[num - 2]
10+
fibo.push(newFibo)
11+
return fibo;
12+
}
13+
var result = recursiveFibo(10)
14+
console.log(result);

0 commit comments

Comments
 (0)