Skip to content

Commit

Permalink
Task solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik-Dudek-code committed Oct 17, 2024
1 parent 9b9a80d commit 729388b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/makeRobotAccountant.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,19 @@
*/

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

return (numberOne = 0) => {
return (numberTwo = 0) => {
numberOfCalls++;

const numbersSum = numberOne + numberTwo;

return numberOfCalls > 3 && numberOfCalls % 2 === 0
? `Bzzz... Error!`
: numbersSum;
};
};
}

module.exports = makeRobotAccountant;

0 comments on commit 729388b

Please sign in to comment.