Skip to content

Commit 048e7fa

Browse files
author
jjcapparell
committed
fixing fibonacci function pt 2
1 parent 81e55b4 commit 048e7fa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lesson_07/conditionals/src/lesson7.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ export function addNumbers(values: number[]): number {
152152
export function getFirstNFibonacciNumbers(n: number): number[] {
153153
const list: number[] = [];
154154
const indices = Array.from({ length: n - 1 }, (_, index) => index + 2);
155-
if (n>=0){
156-
list.push(0);
157-
}
158155
if (n>=1){
159156
list.push(1);
160157
}
161158
if (n>=2){
159+
list.push(1);
160+
}
161+
if (n>=3){
162162
for (const i of indices) {
163163
list[i] = list[i - 1] + list[i - 2];
164164
}

0 commit comments

Comments
 (0)