Skip to content

Conversation

@A1-4U2T1NN
Copy link
Contributor

No description provided.

export function getFirstNFibonacciNumbers(n: number): number[] {
return [];

const array = [n]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably don't want to put n here. If the function is called with 99, then the array will be initialized to [99] which is not what you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to start the array as [1, 1] instead of [n]


const array = [n]

for(let i = 2; i < n; i++){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are you going to do if n === 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added else-if condition for n === 1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added to return [1]

@A1-4U2T1NN A1-4U2T1NN deleted the lesson_07 branch October 14, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants