aboutsummaryrefslogtreecommitdiff
path: root/node_modules/reusify/benchmarks/fib.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/reusify/benchmarks/fib.js')
-rw-r--r--node_modules/reusify/benchmarks/fib.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/node_modules/reusify/benchmarks/fib.js b/node_modules/reusify/benchmarks/fib.js
new file mode 100644
index 0000000..e22cc48
--- /dev/null
+++ b/node_modules/reusify/benchmarks/fib.js
@@ -0,0 +1,13 @@
+'use strict'
+
+function fib (num) {
+ var fib = []
+
+ fib[0] = 0
+ fib[1] = 1
+ for (var i = 2; i <= num; i++) {
+ fib[i] = fib[i - 2] + fib[i - 1]
+ }
+}
+
+module.exports = fib