diff --git a/08_calculator/calculator.js b/08_calculator/calculator.js index 28a6476..f405111 100644 --- a/08_calculator/calculator.js +++ b/08_calculator/calculator.js @@ -13,8 +13,11 @@ const sum = function(array) { return output; }; -const multiply = function() { - +const multiply = function(array) { + const output = array.reduce((multiplification, value) => { + return multiplification * value; + }, 1); + return output; }; const power = function() { diff --git a/08_calculator/calculator.spec.js b/08_calculator/calculator.spec.js index 33e9367..32fe258 100644 --- a/08_calculator/calculator.spec.js +++ b/08_calculator/calculator.spec.js @@ -39,11 +39,11 @@ describe('sum', () => { }); describe('multiply', () => { - test.skip('multiplies two numbers', () => { + test('multiplies two numbers', () => { expect(calculator.multiply([2, 4])).toBe(8); }); - test.skip('multiplies several numbers', () => { + test('multiplies several numbers', () => { expect(calculator.multiply([2, 4, 6, 8, 10, 12, 14])).toBe(645120); }); });