como usar o coalesce no javascript es6
January 04, 2020
Returns the first non-null/undefined argument.
Use Array.prototype.find()
to return the first non null
/undefined
argument.
const coalesce = (...args) => args.find(_ => ![undefined, null].includes(_));
coalesce(null, undefined, '', NaN, 'Waldo'); // ""