Skip to content
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

Closure confusion #90

Open
oreliable opened this issue Sep 3, 2016 · 2 comments
Open

Closure confusion #90

oreliable opened this issue Sep 3, 2016 · 2 comments

Comments

@oreliable
Copy link

Use closures, but don't nest them.

https://github.com/felixge/node-style-guide#no-nested-closures

This is a little funny considering the whole point of closures is to nest them so they close over variables in their parent scope.

The examples provided are just.. regular functions.

@robbiesmith79
Copy link

I see the point trying to be made. The point of a function is so that it can be reused as often as possible. Extracting the function to be by itself allows you to write less code and enhances the notion that the single point of failure is easier obtained. Also, that you can a more controlling perspective if you have to change it. Better off, in this case, you adjust the function to accept any string, so the callback just sends a string to be consoled.

@krystianity
Copy link

If you are not working with Promises or Chains

Use closures, but don't nest them.

is probably the only chance to prevent "Callback Hell"

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

No branches or pull requests

3 participants