From d3412c14234ecdb34f92782f8dfe24a85e19c054 Mon Sep 17 00:00:00 2001 From: Rhys <105ron@users.noreply.github.com> Date: Thu, 27 Sep 2018 14:18:29 +0800 Subject: [PATCH 1/5] Update calculator.js --- calculator/calculator.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/calculator/calculator.js b/calculator/calculator.js index 6fa7dd9..ac5d6e1 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -10,8 +10,9 @@ function sum(array) { return array.reduce((current, total) => total + current, 0); } -function multiply(array) { - return array.reduce((current, total) => total * current, 1); +function multipy (array) { + return array.length + ? array.reduce((accumulator, nextItem) => accumulator * nextItem): 0; } function power(a, b) { From 7b03e764bb498511c104b02fd3e8df9752ff1ef7 Mon Sep 17 00:00:00 2001 From: Rhys <105ron@users.noreply.github.com> Date: Fri, 28 Sep 2018 13:35:21 +0800 Subject: [PATCH 2/5] Update calculator.js Fix typo --- calculator/calculator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calculator/calculator.js b/calculator/calculator.js index ac5d6e1..56b6288 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -10,7 +10,7 @@ function sum(array) { return array.reduce((current, total) => total + current, 0); } -function multipy (array) { +function multiply (array) { return array.length ? array.reduce((accumulator, nextItem) => accumulator * nextItem): 0; } From 5156aa6611ecc0b811f58dda86f7bc2606608dc1 Mon Sep 17 00:00:00 2001 From: Rhys <105ron@users.noreply.github.com> Date: Fri, 28 Sep 2018 13:35:40 +0800 Subject: [PATCH 3/5] Update calculator.js --- calculator/calculator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calculator/calculator.js b/calculator/calculator.js index 56b6288..6037434 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -10,7 +10,7 @@ function sum(array) { return array.reduce((current, total) => total + current, 0); } -function multiply (array) { +function multiply(array) { return array.length ? array.reduce((accumulator, nextItem) => accumulator * nextItem): 0; } From 3182c2c22d5f72b82bac2edefdaaf4b01948480c Mon Sep 17 00:00:00 2001 From: Rhys <105ron@users.noreply.github.com> Date: Fri, 28 Sep 2018 13:36:03 +0800 Subject: [PATCH 4/5] Update calculator.js --- calculator/calculator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/calculator/calculator.js b/calculator/calculator.js index 6037434..5ec472d 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -12,7 +12,8 @@ function sum(array) { function multiply(array) { return array.length - ? array.reduce((accumulator, nextItem) => accumulator * nextItem): 0; + ? array.reduce((accumulator, nextItem) => accumulator * nextItem + : 0; } function power(a, b) { From 3e2816967224dd51752f7ccdee1531369ea08c0f Mon Sep 17 00:00:00 2001 From: Rhys <105ron@users.noreply.github.com> Date: Fri, 28 Sep 2018 13:38:36 +0800 Subject: [PATCH 5/5] Update calculator.js --- calculator/calculator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calculator/calculator.js b/calculator/calculator.js index 5ec472d..2e08f49 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -12,7 +12,7 @@ function sum(array) { function multiply(array) { return array.length - ? array.reduce((accumulator, nextItem) => accumulator * nextItem + ? array.reduce((accumulator, nextItem) => accumulator * nextItem) : 0; }