Skip to content

Conversation

@serhii-baksheiev
Copy link
Contributor

No description provided.

OlegLustenko
OlegLustenko previously approved these changes Jun 22, 2018
// return ++counter
// },
// method2: function(){
// return counter = 0
Copy link
Member

Choose a reason for hiding this comment

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

лучше сначала обнулить счетчик, а после вернуть результат его значения, написать это в двух разных строках

function methodCounter(obj, name, num, fn) {
obj[name] = function(...args){
if(num>0){
return [num--, fn(args)]
Copy link
Member

Choose a reason for hiding this comment

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

как правило есть смысл разделить аргумент num и счетчик который положишь в замыкание

т.е сделать 2 разных переменных

// *
// * */

// function add(x) {
Copy link
Member

Choose a reason for hiding this comment

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

Если задача решена, то не комментируй ее в тот момент когда пушишить непосредственно на github

@OlegLustenko OlegLustenko merged commit 4de6551 into master Jun 27, 2018
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