Reputation: 1593
I have a function declared like so;
+(function () { ... }());
Not my code, but I've been tasked with maintaining it, so knowing what's going on would be mighty handy. That's the only thing in the file, nothing else. JSHint complains with Expected an assignment or function call and instead saw an expression.
and points to the ))
as being the issue.
I've got a very basic understanding of why there's brackets around the function, although that understanding could definitely be improved. I don't know what the +
is for. Nor do I know why JSHint is complaining. Maybe the two are related?
Upvotes: 0
Views: 58
Reputation: 664548
Linters are quite finicky about which of the many styles to make IIFEs work to pick.
In your case you were using two approaches at once, drop the +
and JShint should be happy.
Upvotes: 1