Function to find the minimum value in Javascript Arrays

PHOTO EMBED

Sun Jan 05 2020 19:31:48 GMT+0000 (Coordinated Universal Time)

Saved by @bezequi #javascript #webdev #arrays #math

const arrMin = arr => Math.min(...arr);
// arrMin([20, 10, 5, 10]) -> 5

content_copyCOPY

Math is a built in object in JavaScript that contains certain methods useful for performing mathematical tasks. One of these methods is min(). Math.min() , as expected, returns the smallest of any set of given numbers.

https://codeburst.io/javascript-arrays-finding-the-minimum-maximum-sum-average-values-f02f1b0ce332