Skip to content

Conversation

@illia-001
Copy link

Solution

return this;
},
operate(callback, number) {
calculator.result = callback(number);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result of operation assinged to result 2 times. First time inside arithmetic operation and second time directly from callback return

const calculator = {
result: 0,
add(number) {
calculator.result += number;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fields from parent object should be called using keyword this
Same to all below

Copy link

@Dimononon Dimononon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost, need some adjustments)

@illia-001 illia-001 requested a review from Dimononon December 15, 2025 07:50
Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Excellent work on your calculator implementation! Your solution meets all the functional and style requirements outlined in the task. The code is clean, logical, and demonstrates a strong understanding of the concepts involved. Your use of .call() within the operate method to manage the context of the callback functions is a particularly great solution. I'm happy to approve this submission.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Copy link

@Dimononon Dimononon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants