-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
everything is completed #2333
base: master
Are you sure you want to change the base?
everything is completed #2333
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.
The makeCalculator
function is well-structured and follows most of the best practices according to the checklist provided. However, there are a few improvements that can be made to align it with the given checklist.
@@ -3,8 +3,35 @@ | |||
/** | |||
* @return {object} | |||
*/ | |||
|
|||
// `add`, `subtract`, `multiply`, `divide`, `reset`, `operate` | |||
|
|||
function makeCalculator() { |
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.
According to the naming convention in the checklist, if a function is named makeCalculator
, it should return an object named calculator
. Currently, the function returns an object without a specific name. Consider adjusting the code to follow this convention if it's required by your project's guidelines.
|
||
return this; | ||
}, | ||
operate(operation, val) { |
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.
The operate
method can be improved by directly invoking the passed operation on this.result
with the provided value instead of using call
. This would simplify the implementation and avoid the unnecessary use of this
binding, which is not needed as the methods add
, subtract
, multiply
, divide
are already using this
to refer to the calculator object.
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.
comment not fixed
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.
Good job.
Please fix prev comments.
|
||
return this; | ||
}, | ||
operate(operation, val) { |
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.
comment not fixed
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.
lgtm 🚀
No description provided.