Skip to content

Commit

Permalink
Converting functions to arrows functions and connect conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
WGoliasz committed Aug 20, 2024
1 parent f7cf21a commit 14b8c04
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/makeRobotAccountant.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@
function makeRobotAccountant() {
let count = 0;

return function(a) {
return function(b) {
return (a) => {
return (b) => {
count++;

if (count <= 3 || count % 2 !== 0) {
const sum = a + b;

return sum;
} else {
return 'Bzzz... Error!';
}
return count <= 3 || count % 2 !== 0
? a + b : 'Bzzz... Error!';
};
};
}
Expand Down

0 comments on commit 14b8c04

Please sign in to comment.