Languages
[Edit]
EN

JavaScript - how to find min value in array with Array reduce method?

7 points
Created by:
Wiktor-Sribiew
350

Using JavaScript it is possible to find minimum value in array in following way.

1. Array reduce method example

// ONLINE-RUNNER:browser;

const array = [3, 1, 2];

const result = array.reduce(function(a, b) {
    return Math.min(a, b);
});

console.log(result);  // 1

See also

  1. JavaScript - Math.min() method example
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join