From 9ed5add7eca4a985a96a10fdae051dbdbab8ac99 Mon Sep 17 00:00:00 2001 From: Bernardo Gomes Date: Sun, 22 Oct 2017 16:12:30 -0200 Subject: [PATCH] Fibo fix. --- Chapter 4/fibonacci/math.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Chapter 4/fibonacci/math.js b/Chapter 4/fibonacci/math.js index 5896fc3..9515d1a 100644 --- a/Chapter 4/fibonacci/math.js +++ b/Chapter 4/fibonacci/math.js @@ -1,8 +1,8 @@ var fibonacci = exports.fibonacci = function(n) { - if (n === 1) + if (Math.trunc(n) === 1) return 1; - else if (n === 2) + else if (Math.trunc(n) === 2) return 1; else return fibonacci(n-1) + fibonacci(n-2);