get minimum value from an array

I think it shows a good use of the spread operator in variadic functions
This commit is contained in:
Elder Henrique Souza
2017-12-12 15:53:20 -02:00
committed by GitHub
parent 2599150e76
commit b5e886f7a3

View File

@ -0,0 +1,8 @@
### Get min value from array
Passing an array, it executes the Math.min method using the spread operator to fill its variadic arguments
```js
const getMinValue = arr => Math.min(...arr);
// getMinValue([10, 1, 5) -> 1
```