Skip to content

Commit

Permalink
Solution makeRobotAccountant
Browse files Browse the repository at this point in the history
  • Loading branch information
BagietaCyganeta committed May 23, 2024
1 parent 9b9a80d commit 2adfc7b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/makeRobotAccountant.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,21 @@
*/

function makeRobotAccountant() {
// write code here
let count = 0;

function getSum(a) {
return function(b) {
count++;

if (count > 3 && count % 2 === 0) {
return 'Bzzz... Error!';
} else {
return a + b;
}
};
}

return getSum;
}

module.exports = makeRobotAccountant;

0 comments on commit 2adfc7b

Please sign in to comment.