DEV Community

Nagarajan R
Nagarajan R

Posted on

Answer: Find the min/max element of an Array in JavaScript

Using spread operator (ES6)

Math.max(...array)  // The same with "min" => Math.min(...array)
const array = [10, 2, 33, 4, 5];

console.log(
  Math.max(...array)
)

Top comments (0)