-
Notifications
You must be signed in to change notification settings - Fork 907
Open
Description
I agree that multi-line ternary operators make sense. However, the following is (as far as I know) bad, due to ASI:
var foo = (a === b)
? 1
: 2;
JShint will throw an error on this code, saying “Bad line breaking before '?'”.
If you insist on using multi-line ternary operators, you might prefer the following style:
var foo = (a === b) ?
1 :
2;
I agree that it is less readable, because the question mark and the colon are more obvious at the beginning of the line. But I wouldn’t want to mess with ASI and depend on implicit fixes of the JS engine, either.
plashchynski
Metadata
Metadata
Assignees
Labels
No labels