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 271130ef08
commit 8b88149ce2

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
```