Skip to content

Bug - Build an Nth Fibonacci Number Calculator (javascript-v9) #66910

@WongYC-66

Description

@WongYC-66

Describe the Issue

Not using recursion in solution, but still can't pass.

  • Test case#11. You should not use recursion in your code.

Related forum post:

Affected Page

https://www.freecodecamp.org/learn/javascript-v9/lab-nth-fibonacci-number-js/build-an-nth-fibonacci-number-calculator

Your code


const fibonacci = (n) => {
  let sequence = [0, 1]

  for (let i = 2; i <= n; i++) {
    sequence.push(sequence[i - 1] + sequence[i - 2])
  }

  return sequence[n]
}

Expected behavior

Iterative DP solution.
Should have passed.

Screenshots

Image

System

  • Device: [e.g. iPhone 6, Laptop]
  • OS: [e.g. iOS 14, Windows 10, Ubuntu 20.04]
  • Browser: [e.g. Chrome, Safari]
  • Version: [e.g. 22]

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedOpen for all. You do not need permission to work on these.js v9 certThis is for the JS V9 certification.scope: curriculumLessons, Challenges, Projects and other Curricular Content in curriculum directory.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions