Member-only story
Project Euler Problem 2 Solved with Javascript
Getting all the even Fibonacci numbers

Welcome to Round Two of Project Euler! This time we’re heading into the land of state management and that guy you’ve probably heard about: Fibonacci! I’m excited, are you excited?
Check out the solution for Problem 1 here:
Video Version
If you like to watch rather than read, check out the video that accompanies this article. If not, keep reading!
Problem 2: Even Fibonacci Numbers
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …
Problem Statement
By considering the terms in the Fibonacci sequence that do not exceed the nth
term, find the sum of the even-valued terms.
Solution
Breakdown of the Problem
Fibonacci sequence
It’s stated in the problem, however, let’s discuss what a Fibonacci sequence is a little bit and why it’s important.
The next number is found by adding up the two numbers before it.
When we do this, it creates an interesting spiral, which is found in myriad places in nature.

We could probably talk all day about Fibonacci, but let’s get back to code.