---
meta:
  title: Ternary operator
  description: The ternary operator is a different, often more concise, way of writing an if/else conditional.
---

The ternary operator is a different, often more concise, way of writing
an **if/else** conditional.

If you'd like, Tyrel Chambers wrote an article about the [ternary operator](https://tyrelchambers.com/blog/what-is-a-ternary-operator-in-javascript).

```javascript
const colour = "blue" colour === "blue" ? "It's blue!" : "it's red!"
```
