-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ternary operator and self-executing function #226
Comments
Actually, this function error still happens when I break the function call out into a standard function: var foo;
function myFunc() {
foo = {};
foo.bar = {};
}
; (foo)
? foo.bar = {}
: myFunc()
; |
closed by mistake. |
This also exists when using other operators to create an immediately invoked function expression:
|
@ryanfitzer you can turn that on by setting |
That was it! Thanks soo much. Any clue on the "Missing space after 'function'." warning? This happens if there is no space between the word
I assumed it was the Thanks again. |
It's supposed to be This works for me:
|
Just tried yours and it worked. Not sure why, but Not sure why it would conflict. Bug? |
|
This was fixed in GH-414. |
…into 414 Conflicts: tests/unit/core.js
This issue demonstrates two problems:
PROBLEM 1: When I add a self-executing function as part of a ternary operator expression, I get an error.
Error received from jshint:
Expected an assignment or function call and instead saw an expression. "} ())"
A self-executing function is a function call: it calls itself, and it should be treated as a function call.
EXAMPLE:
PROBLEM 2: Semicolon before expression parentheses.
The initial semicolon above is reported as unnecessary, but can help prevent errors from code that may have been included that did not include appropriate semicolons.
Thanks!
The text was updated successfully, but these errors were encountered: