diff --git a/src/makeRobotAccountant.js b/src/makeRobotAccountant.js index 38b9758a..8ae6089d 100644 --- a/src/makeRobotAccountant.js +++ b/src/makeRobotAccountant.js @@ -4,9 +4,22 @@ * * @return {function} */ - function makeRobotAccountant() { - // write code here + let count = 0; + + return function(number1) { + count++; + + if (count > 3 && count % 2 === 0) { + return function() { + return 'Bzzz... Error!'; + }; + } else { + return function(number2) { + return number1 + number2; + }; + } + }; } module.exports = makeRobotAccountant;