(function(){ var a1 = [], a=1, b=0, c; for(var i=1; i<31; i++){ c=a+b; a=b; b=c; a1.push(c); } alert(a1); console.log('['+a1.join(', ')+']'); }());