Skip to content

task is done#12

Open
DenisSteshin wants to merge 1 commit into
masterfrom
ex13_js-context
Open

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

Conversation

@DenisSteshin

Copy link
Copy Markdown
Owner

No description provided.

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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