function fib(n) { var a = 0, b = 1, t; while (n-- > 0) { t = a; a = b; b += t; console.log(a); } return a; }