1 # disallow ternary operators (no-ternary)
3 The ternary operator is used to conditionally assign a value to a variable. Some believe that the use of ternary operators leads to unclear code.
6 var foo = isBar ? baz : qux;
11 This rule disallows ternary operators.
13 Examples of **incorrect** code for this rule:
16 /*eslint no-ternary: "error"*/
18 var foo = isBar ? baz : qux;
21 return foo ? bar() : baz();
25 Examples of **correct** code for this rule:
28 /*eslint no-ternary: "error"*/
49 * [no-nested-ternary](no-nested-ternary.md)
50 * [no-unneeded-ternary](no-unneeded-ternary.md)