Nullish and logical OR operator

// Nullish operator**
let a = null;
let b = a ?? "default"; // "default"

let c = 0;
let d = c ?? "default"; // 0 (because 0 is not null or undefined)

// Logical OR operator
let a = null;
let b = a || "default"; // "default"

let c = 0;
let d = c || "default"; // "default" (because 0 is falsy)

Use ?? when you only want to replace null or undefined values.

Use || when you want to replace any falsy value.