update snippets 16-31

This commit is contained in:
Stefan Feješ
2017-12-25 14:05:36 +01:00
committed by Agamemnon Zorbas
parent b2cffa6858
commit 014a77224c
15 changed files with 70 additions and 30 deletions

View File

@ -5,6 +5,9 @@ Returns the first non-null/undefined argument.
Use `Array.find()` to return the first non `null`/`undefined` argument.
```js
const coalesce = (...args) => args.find(_ => ![undefined, null].includes(_));
// coalesce(null,undefined,"",NaN, "Waldo") -> ""
const coalesce = (...args) => args.find(_ => ![undefined, null].includes(_))
```
```js
coalesce(null,undefined,"",NaN, "Waldo") // ""
```