make min max average and sum snippets

This commit is contained in:
Rohit Tanwar
2017-12-29 16:59:49 +05:30
parent 7c6541366d
commit 6bccc94364
7 changed files with 42 additions and 42 deletions

13
snippets/max.md Normal file
View File

@ -0,0 +1,13 @@
### max
Returns the maximum value out of two or more numbers/arrays.
Use `Math.max()` combined with the spread operator (`...`) to get the maximum value in the array.
```js
const max = (...arr) => Math.max(...[].concat(...arr);
```
```js
max([10, 1, 5]); // 10
```