fibo.js: Fibonacci sequence

1.0
Ariya Hidayat 2010-12-27 22:04:04 -08:00
parent 243dc0f82c
commit 2153e5ebea
1 changed files with 9 additions and 0 deletions

9
examples/fibo.js Normal file
View File

@ -0,0 +1,9 @@
var fibs = [0, 1];
var ticker = window.setInterval(function () {
phantom.log(fibs[fibs.length - 1]);
fibs.push(fibs[fibs.length - 1] + fibs[fibs.length - 2]);
if (fibs.length > 10) {
window.clearInterval(ticker);
phantom.exit();
}
}, 300);