From 809a3940fbc6def7039b532656e136f911ad60e4 Mon Sep 17 00:00:00 2001 From: shreyasingh28 <44510510+shreyasingh28@users.noreply.github.com> Date: Mon, 7 Oct 2019 10:45:00 +0530 Subject: [PATCH] create fibonacci code --- fibb.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 fibb.js diff --git a/fibb.js b/fibb.js new file mode 100644 index 00000000..a6013869 --- /dev/null +++ b/fibb.js @@ -0,0 +1,16 @@ +var fibonacci_series = function (n) +{ + if (n===1) + { + return [0, 1]; + } + else + { + var s = fibonacci_series(n - 1); + s.push(s[s.length - 1] + s[s.length - 2]); + return s; + } +}; + + console.log(fibonacci_series(8)); +