make min max average and sum snippets
This commit is contained in:
13
snippets/min.md
Normal file
13
snippets/min.md
Normal file
@ -0,0 +1,13 @@
|
||||
### min
|
||||
|
||||
Returns the minimum value in an array.
|
||||
|
||||
Use `Math.min()` combined with the spread operator (`...`) to get the minimum value in the array.
|
||||
|
||||
```js
|
||||
const min = arr => Math.min(...[].concat(...arr));
|
||||
```
|
||||
|
||||
```js
|
||||
min([10, 1, 5]); // 1
|
||||
```
|
||||
Reference in New Issue
Block a user