TypeScriptObjectnullish coalescing
optional chaining

nullish coalescingObject

Promise.all

Returns the right-hand operand when the left-hand operand is null or undefined.

Syntax

value ?? defaultValue

Example

Enter values below to update the example in real time.

const
name
console
zero
nullish
const name = null ?? "default";
console.log(name); // "default"

const zero = 0 ?? 42;
console.log(zero); // 0 (0은 nullish가 아님)