Skip to main content

Posts

Showing posts from 2023

Create a Fibonacci Sequence function using JavaScript

As a product developer, I tend to focus on developing complex solutions and often times forget about coding basics. I constantly write and deploy code, but It's common to get stuck in the product development rut of reusing pre-developed blocks of code throughout the system. In order sharpen my skills. I made it a goal to revisit popular coding exercises and see how I can solve them now that I have a few years of working experience.  The fibonacci sequence came across my path once again! I've been asked how to calculate the sequence in past interviews, and it's fairly straight forward. For those not familiar, here's the sequence: 0 1 1 2 3 5 8 13 21 Essentially, the sum of the first two values is the third value...and the sum of the second and third value is the fourth value, and so on. There's a couple of ways to solve this problem. Solution #1 The n parameter is basically an index stopping point.  In other words, how large do I want the array to be ?  I set a def...