coalesce
Returns a step that represents to the first non-nullish1 value from the
provided steps, or null
if they are all nullish. Steps can be passed either as
individual arguments or as a single array.
Inhibited steps passed to coalesce()
will not cause the coalesce()
itself to be inhibited.
Usage:
const $coalesced = coalesce($a, $b, $c);
// or
const $coalesced = coalesce([$a, $b, $c]);
- "Nullish" meaning
null
orundefined
.↩