Languages
[Edit]
EN

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

7 points
Created by:
JustMike
3494

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

1. Array reduce method example

// ONLINE-RUNNER:browser;

var array = [1, 2, 3];

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

console.log(result);

See also

  1. JavaScript - Math.min() method example
Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.