Created
October 11, 2019 09:48
-
-
Save Reikon95/408bda07e8a4f19f189795693994fcab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fiboEvenSum(n) { | |
| let result = [1, 2]; | |
| for (let i = 0; i < (n -1); i++) { | |
| let sum = (result[result.length - 1] + result[result.length - 2]); | |
| result.push(sum); | |
| } | |
| let counter = 0; | |
| for (let num of result) { | |
| num % 2 === 0 ? counter += num; | |
| } | |
| return counter; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment