Fork me on GitHub

JSLint Error Explanations

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


Function declarations should not be placed in blocks

When do I get this error?

JSHint will throw the "Function declarations should not be placed in blocks" error when it encounters a function declaration inside a block statement. In the following example we attempt to declare the example function if some condition evaluates to true:

This is the JSHint equivalent of the "Function statements should not be placed in blocks" error from JSLint. More detail can be found on the page for the JSLint message.


comments powered by Disqus