JSLint error: "Move the invocation into the parens that contain the function"

JavascriptJqueryDebuggingCompiler ErrorsJslint

Javascript Problem Overview


What does JSLint mean by this error? And how should it be rewritten?

Error: Problem at line 78 character 3: Move the invocation into the parens that contain the function: })(jQuery);

Javascript Solutions


Solution 1 - Javascript

To pass JSLint's criteria, it needs to be written like this:

}(jQuery));

Though I think that particular criteria is a bit subjective. Both ways seem fine in my opinion.

(function () {})() makes a bit more sense to me since you wrap the full function, then call it

(function () {}()) looks like you're wrapping the result of the function call in a parens ...

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSåmView Question on Stackoverflow
Solution 1 - JavascriptMattView Answer on Stackoverflow