var 20 var fibs fibs fibs for var fibs fibs i-1 fibs i-2 log fibs docu

1
2
3
4
5
6
7
8
9
var n = 20;
var fibs = [];
fibs[0] = 1;
fibs[1] = 1;
for (var i = 2; i < n; i++) {
fibs[i] = fibs[i-1] + fibs[i-2];
}
log(fibs);
document.write('<ul><li>' + fibs.join('</li><li>') + '</li></ul>');