title: How to return the sum of only even numbers in Fibonacci sequence?
body: <p>I'm struggling to make this loop work. Is the for/while loop a good way to return the sum of even numbers in a Fibonacci sequence?</p>
  
  <pre><code>   function evenFib() {
    var x, y, total;
    for (var i = 0; i &lt; 10; i++) {
      if (i === 0) {
        x = 1;
        y = 2;
      }
  
      while( x %2===0) {
        total = x + y;
        x = y;
        y = total;
      }
  
      return(total);
    }
  };
  </code></pre>