Skip to content

Commit

Permalink
Created a function makeRobotAccountant
Browse files Browse the repository at this point in the history
  • Loading branch information
YarynaPuhach committed Feb 23, 2024
1 parent 9b9a80d commit 4b51ccc
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;

const getSum = function(a) {
count++;

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

return a + b;
};
};

return getSum;
}

module.exports = makeRobotAccountant;

0 comments on commit 4b51ccc

Please sign in to comment.