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

Function declarations -- antipattern? #72

Open
padolsey opened this issue Mar 18, 2013 · 2 comments
Open

Function declarations -- antipattern? #72

padolsey opened this issue Mar 18, 2013 · 2 comments

Comments

@padolsey
Copy link

Here you mention that function declarations are an anti-pattern. However you don't substantiate this. Do you say this because FunctionDeclaration hoisting is sometimes considered confusing?

I don't believe Function Declarations are an anti-pattern at all. In fact they're favourable in many cases --

  1. for debuggability
  2. for semantics
  3. sometimes hoisting is useful (declaring static constants above a FuncDec
@nickdesaulniers
Copy link

+1

@adambabik
Copy link

+1

I cannot agree that function declaration is an anti-pattern. I even prefer it over the other possibilities because it clearly says that I define a function.

Moreover, it's extremely popular in node source code and in many successful libraries where people really care about code quality.

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