nullish coalescing

The double question mark operator (??), which gives a fallback value only when the left side is null or undefined.

In more detail

Unlike ||, it keeps other falsy values such as 0 and the empty string, so retries ?? 3 keeps a real 0. Nullish means null or undefined.

Example

const ip = entry.metadata["client_ip"] ?? "unknown";

Related terms

Taught in

References