Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function evenFiboSum(ceilingValue) {
- let sum = 0;
- let x = 1;
- let y = 2;
- while (x <= ceilingValue) {
- if (x % 2 == 0) {
- sum += x;
- }
- y = x + y;
- x = y - x;
- }
- return sum;
- }
- console.log(evenFiboSum(4000000));
Add Comment
Please, Sign In to add comment