Demystifying JavaScript Variable Scope and Hoisting

There is no reason for using function declarations in JavaScript. They don’t always work where as the alternative of creating an anonymous function and assigning it to a variable always works.