Ternary Operator

The ?: operator, which chooses one of two values from a condition.

What does Ternary Operator do in JavaScript?

Ternary Operator — The ?: operator, which chooses one of two values from a condition.

const label = stock > 0 ? "Available" : "Sold out";

Level: Apprentice · More JavaScript terms at this level

Updated

In other subjects