Chrome Extension

Find the minimum value from an array javascript

We can easily get the minimum value from an array using javascript. we can use .reduce() function of array to make it easily.
const myarr = [10, 23, 65, 7, 24];
const min_val = myarr.reduce((a, b) => a < b ? a : b);
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

Here we have an array which has five integers values in it and we want to get the lowest value which this array contains. We are using .reduce() method of array for this purpose.

Example Demo

Was this helpful?