function fib(num) { a = 1; b = 1; c = a + b; for (i = 1; i <= num; i++) { a = c; b = a - b; c = a + b; console.log(c); } } fib(1000);
function fib(num) { var a = 1, b = 1; var c = a + b; for (i = 1; i <= num; i++) { a = b; b = c; c = a + b; if (c > 1000) { return ('Eto vse'); } console.log(c); } } fib(1000);