Skip to content

Instantly share code, notes, and snippets.

@Reikon95
Created October 11, 2019 09:48
Show Gist options
  • Select an option

  • Save Reikon95/408bda07e8a4f19f189795693994fcab to your computer and use it in GitHub Desktop.

Select an option

Save Reikon95/408bda07e8a4f19f189795693994fcab to your computer and use it in GitHub Desktop.
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