Skip to content

Comments

task is done#12

Open
DenisSteshin wants to merge 1 commit intomasterfrom
ex13_js-context
Open

task is done#12
DenisSteshin wants to merge 1 commit intomasterfrom
ex13_js-context

Conversation

@DenisSteshin
Copy link
Owner

No description provided.

@@ -0,0 +1,64 @@
function CreateCalculator() {
let result = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

this.result = 0 и дальше по коду используешь this

if (isNaN(value)) {
return this;
}
result -= value;
Copy link
Collaborator

Choose a reason for hiding this comment

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

this.result

};
}

const Calculator = CreateCalculator();
Copy link
Collaborator

Choose a reason for hiding this comment

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

const Calculator = new CreateCalculator();

Copy link
Collaborator

Choose a reason for hiding this comment

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

когда работаем с контекстом нужно создавать новые объект через new

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