-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #2388
base: master
Are you sure you want to change the base?
Develop #2388
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on the implementation! 👍 Just a few code style suggestions to keep in mind for the future: try to keep your code DRY by combining conditions when possible, avoid nesting ternary operators for better readability, and consider using anonymous functions when naming isn't necessary. These changes can help make your code even cleaner and easier to maintain! Keep up the good work!
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
return a + b; | ||
} | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[CODE STYLE] - You don't need to name functions if you return them right away. Consider using anonymous functions instead to make the code cleaner. For example, return function (b) { ... };
src/makeRobotAccountant.js
Outdated
if (callCount > 3 && callCount % 2 === 0) { | ||
return "Bzzz... Error!"; | ||
} else { | ||
return a + b; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[CODE STYLE] - Try not to nest ternary operators. Instead, you can use a single conditional statement or separate the logic into multiple statements to improve readability.
src/makeRobotAccountant.js
Outdated
if (callCount > 3 && callCount % 2 === 0) { | ||
return "Bzzz... Error!"; | ||
} else { | ||
return a + b; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[CODE STYLE] - DRY. You can combine conditions to simplify the logic. For instance, you can check if callCount
is less than or equal to 3 to return the sum directly, reducing the need for an else block.
No description provided.