Skip to content

fabiodeandrade/Fibonacci-Sequence-in-JS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Fibonacci function in Javascript

appCover

🎯 Objective

I created this repo to show my logic to Fibonacci sequence and futuraly refactor with new features from javascript

How about the logic?

First of all i needed to read a human function to fibonacci sequence.

The Fibonacci sequence is a set of numbers that starts with a one or a zero, followed by a one, and proceeds based on the rule that each number (called a Fibonacci number) is equal to the sum of the preceding two numbers.

After that i needed to translate this to javascript world. firstly i think about the params of the function: totalNumberOfSequence, a array to get this params and transform to your length fibArray.

I give the first and second index from fibArray to initiate the sequence; create a logic loop to get a sequence from the third index and add a new number in array with fibonacci logic.

fibArray[i] = fibArray[i - 2] + fibArray[i - 1]

πŸ”§ Next steps

  • Refactoring with new javascript features

About

πŸ’« Logic about the fibonacci sequence in javascript function

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published