From a04808462e63055ebfe53a261093e0c809310663 Mon Sep 17 00:00:00 2001 From: "stanciuionelamelania@gmail.com" Date: Fri, 19 Jan 2018 10:02:48 +0000 Subject: [PATCH] Done. --- index.js | 35 +++++++++++++++++++++++++++++++++++ test/index-test.js | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index e69de29..acb4524 100644 --- a/index.js +++ b/index.js @@ -0,0 +1,35 @@ + function makeInt(n){ + return parseInt(n,10) + } + + function preserveDecimal(n){ + return parseFloat(n) + } + + function add(a,b){ + return a + b + } + + function substract(a, b){ + return a - b + } + function multiply(a,b){ + return a * b + } + + function divide(a , b){ + if (b !==0 ){ + return a/b + } + else { + return NaN + } + } + + function inc(n){ + return ++n + } + + function dec(n){ + return --n + } diff --git a/test/index-test.js b/test/index-test.js index 7c95472..bbe7b33 100644 --- a/test/index-test.js +++ b/test/index-test.js @@ -10,7 +10,7 @@ it('add(a, b) adds two numbers and returns the result', function() { }) it('subtract(a, b) subtracts b from a and returns the result', function() { - expect(subtract(a, b)).toEqual(a - b) + expect(substract(a, b)).toEqual(a - b) }) it('multiply(a, b) multiplies two numbers and returns the result', function() {