Update coalesce.md

This commit is contained in:
Angelos Chalaris
2017-12-18 12:16:18 +02:00
committed by GitHub
parent 8f6a8f2143
commit 767d1e9a1b

View File

@ -1,6 +1,8 @@
### Coalesce a set of arguments ### coalesce
Use `find()` to return the first non null/undefined argument. Returns the first non-null/undefined argument.
Use `Array.find()` to return the first non `null`/`undefined` argument.
```js ```js
const coalesce = (...args) => args.find(_ => ![undefined, null].includes(_)) const coalesce = (...args) => args.find(_ => ![undefined, null].includes(_))