What in world is the Fibonacci Sequence? Let’s break it down first — what is a sequence and a series. A series in math is the sum of a list of numbers that are creating some pattern or following some rule. This then becomes classified as a sequence, when that set of numbers is following some pattern.

The Fibonacci Sequence is a series of numbers, in which each number is called a fibonacci number. In this sequence the fib number is the sum of the previous two numbers before it.

Now that we have a clue what the Fibonacci Sequence is, let’s do some recursive problem solving.

PROBLEM: Write a function ‘fib(n)’ that takes in a number as an argument. The function should return the n-th number of the Fibonacci Sequence. In our case, let’s do the 8th number.

We want the 8th number of the sequence — how do you go about this? Let’s draw it out:

#memoization #series #javascript #recursion

Fibonacci Sequence — JavaScript, Recursion & Memoization
1.55 GEEK