source:
trip-planner-front/node_modules/reusify/benchmarks/fib.js@
eed0bf8
Last change on this file since eed0bf8 was 6a3a178, checked in by , 3 years ago | |
---|---|
|
|
File size: 177 bytes |
Rev | Line | |
---|---|---|
[6a3a178] | 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.