Menu
Coddy logo textTech

19. Fibonacci iteratively

Lesson 20 of 31 in Coddy's 30 Days of Logic Building in Javascript course.

challenge icon

Challenge

Easy

Write a function to generate the nth Fibonacci number iteratively.

  • Input: <strong>6</strong>
  • Output: <strong>8</strong>

Note - Series starting with 1 not 0!

Try it yourself

function fibonacciIterative(n) {
    // write your code below
    
}

All lessons in 30 Days of Logic Building in Javascript