Function declarations -- antipattern?
padolsey opened this issue · comments
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 --
- for debuggability
- for semantics
- sometimes hoisting is useful (declaring static constants above a FuncDec
+1
+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.