By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.fib = (x) ->  return 0 if x == 0  return 1 if x == 1  return fib(x-1) + fib(x-2)i = 2fib_sum = 0while (fib i) < 4000000  n = fib i   if n % 2 is 0 then fib_sum += fib i  i++alert fib_sumI am looking for a more functional solution but I am stuck.EditOptimized the solution:limit = 4000000sum = 0a = 1b = 1while b < limit  if b % 2 is 0 then sum += b  h = a + b  a = b  b = halert sum #4613732
Project Euler question 2 in CoffeeScript
javascript;functional programming;project euler;coffeescript;fibonacci sequence