source:
imaps-frontend/node_modules/reusify/benchmarks/fib.js@
d565449
Last change on this file since d565449 was d565449, checked in by , 4 weeks ago | |
---|---|
|
|
File size: 177 bytes |
Rev | Line | |
---|---|---|
[d565449] | 1 | 'use strict' |
2 | ||
3 | function fib (num) { | |
4 | var fib = [] | |
5 | ||
6 | fib[0] = 0 | |
7 | fib[1] = 1 | |
8 | for (var i = 2; i <= num; i++) { | |
9 | fib[i] = fib[i - 2] + fib[i - 1] | |
10 | } | |
11 | } | |
12 | ||
13 | module.exports = fib |
Note:
See TracBrowser
for help on using the repository browser.