diff --git a/src/makeRobotAccountant.js b/src/makeRobotAccountant.js index 38b9758a..57305303 100644 --- a/src/makeRobotAccountant.js +++ b/src/makeRobotAccountant.js @@ -6,7 +6,21 @@ */ function makeRobotAccountant() { - // write code here + let counter = 0; + + return function(a) { + return function(b) { + counter++; + + if (counter >= 4 && counter % 2 === 0) { + return `Bzzz... Error!`; + } + + const sum = a + b; + + return sum; + }; + }; } module.exports = makeRobotAccountant;