While the ternary operator is pleasingly compact, its use can make code more difficult to read. It should therefore be avoided in favor of the more
verbose if/else structure.
function foo(a) {
var b = (a === 'A') ? 'is A' : 'is not A'; // Noncompliant
// ...
}
function foo(a) {
var b;
if (a === 'A') {
b = 'is A';
}
else {
b = 'is not A';
}
// ...
}