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