Solution#2449
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The solution correctly implements the core logic using a closure to maintain the call count, and the functionality works as expected. However, it violates checklist item #2: 'You don't need to name functions if you return them right away.' The function assigned to robotAccountant is declared with a name (function robotAccountant() { ... }) even though it's returned immediately — it should be an anonymous function instead (e.g., return function() { ... };). This is a required checklist violation, not just a style preference, so changes are needed before approval. Fixing this will align the code with the stated standards while preserving all functionality.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| } | ||
| let callCount = 0; | ||
|
|
||
| return function getSum(a) { |
There was a problem hiding this comment.
This violates checklist item #2: 'You don't need to name functions if you return them right away.' Since this function is returned immediately, it can be an anonymous function.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation of makeRobotAccountant correctly satisfies all functional requirements: the curried function returns the right sums for the first three calls (11, 4, 12), then alternates properly — even calls (4th, 6th, 8th…) return 'Bzzz... Error!', while odd calls (5th, 7th, 9th…) return correct sums (e.g., 71). You’ve used a single callCount variable to track invocations, avoided nested ternary operators, and returned an anonymous arrow function as required [CHECKLIST ITEM #2]. The code is DRY, readable, and fully compliant with the task specification. No critical or blocking issues were found — your solution is approved.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.