Echo JS 0.11.0

<~>

jklu 2212 days ago. link 1 point
just out of curiosity: why do you retain the even values and sum them up later while you are only interested in the sum ?

//
let c = 0;
let a = 1;
let b = 2;
let sum = 0;
while (c < 4000000) {
  c = a + b;
  a = b;
  b = c;
  if (c % 2 == 0) {
    sum += c;
  }
}
console.log(sum);
//