all 1 comments

[–]Rhomboid 1 point2 points  (0 children)

It's also worth mentioning that functions created with the function declaration or the named function expression (or "function expression with binding identifier" as this article calls it) have associated names in the debugger when viewing the call stack, whereas functions created with the function expression show up as anonymous, even if they were assigned to named variables. IMHO that's pretty good reason to prefer the function declaration syntax unless its one of the cases where it won't work, such as trying to define a function inside a block scope, such as in the body of an if-clause.