---
url: /docs/guide/usage/linter/rules/eslint/no-nested-ternary.md
---

### What it does

Disallow nested ternary expressions.

### Why is this bad?

Nested ternary expressions make code harder to read and understand. Nesting of these expressions can lead
to complex logic that is difficult to understand.

### Examples

Examples of **incorrect** code for this rule:

```js
const result = condition1 ? (condition2 ? "a" : "b") : "c";
```

Examples of **correct** code for this rule:

```js
let result;
if (condition1) {
  result = condition2 ? "a" : "b";
} else {
  result = "c";
}
```

## How to use

## Version

This rule was added in v0.15.4.

## References
