Fork me on GitHub

JSLint Error Explanations

JSLint will hurt your feelings. It's time to make them better!


Function declarations are not invocable. Wrap the whole function invocation in parens

When do I get this error?

JSHint will throw the "Function declarations are not invocable. Wrap the whole function invocation in parens" error when it encounters a function declaration followed by a pair of invoking parentheses. In the following example we declare a function example and then attempt to immediately invoke it:

This is the JSHint equivalent of the "Function statements are not invocable" error from JSLint. More detail can be found on the page for the JSLint message.

In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. Since this message relates to a fatal syntax error you cannot disable it.


comments powered by Disqus