How about augmenting the built-in Array object to use Math.max/Math.min instead:

Array.prototype.max = function() {
  return Math.max.apply(null, this);
};

Array.prototype.min = function() {
  return Math.min.apply(null, this);
};

let p = [35,2,65,7,8,9,12,121,33,99];

console.log(`Max value is: ${p.max()}` +
  `\nMin value is: ${p.min()}`);

Here is a JSFiddle.

Augmenting the built-ins can cause collisions with other libraries (some see), so you may be more comfortable with just apply'ing Math.xxx() to your array directly:

var min = Math.min.apply(null, arr),
    max = Math.max.apply(null, arr);

Alternately, assuming your browser supports ECMAScript 6, you can use spread syntax which functions similarly to the apply method:

var min = Math.min( ...arr ),
    max = Math.max( ...arr );
Answer from Roatin Marth on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Math › max
Math.max() - JavaScript | MDN
Math.max(10, 20); // 20 Math.max(-10, -20); // -10 Math.max(-10, 20); // 20 · Array.prototype.reduce() can be used to find the maximum element in a numeric array, by comparing each value: js · const arr = [1, 2, 3]; const max = arr.reduce((a, b) => Math.max(a, b), -Infinity); The following function uses Function.prototype.apply() to get the maximum of an array.
🌐
W3Schools
w3schools.com › jsref › jsref_max.asp
JavaScript Math max() Method
The Math.max() method returns the number with the highest value.
🌐
Programiz
programiz.com › java-programming › library › math › max
Java Math max()
// compare all elements with max // assign maximum value to max max = Math.max(max, arr[i]); } System.out.println("Maximum Value: " + max); } } In the above example, we have created an array named arr.
🌐
Built In
builtin.com › articles › javascript-array-max
3 Methods to Find the JavaScript Array Max | Built In
If the current element is greater, ... } } console.log(max); // Outputs: 8 · JavaScript’s Math.max() can find the maximum among individual numbers....
🌐
Vultr Docs
docs.vultr.com › javascript › standard-library › Math › max
JavaScript Math max() - Find Maximum Value | Vultr Docs
November 27, 2024 - By accepting multiple numbers or an array of numbers (with a spread operator), this method evaluates and returns the largest number in the set, facilitating numerical comparisons directly in your code.
Find elsewhere
🌐
Math.js
mathjs.org › docs › reference › functions › max.html
math.js
math.max(2, 1, 4, 3) // returns 4 math.max([2, 1, 4, 3]) // returns 4 // maximum over a specified dimension (zero-based) math.max([[2, 5], [4, 3], [1, 7]], 0) // returns [4, 7] math.max([[2, 5], [4, 3], [1, 7]], 1) // returns [5, 4, 7] math.max(2.7, 7.1, -4.5, 2.0, 4.1) // returns 7.1 math.min(2.7, 7.1, -4.5, 2.0, 4.1) // returns -4.5
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › find-the-min-max-element-of-an-array-using-javascript
Min and Max of an Array in JavaScript - GeeksforGeeks
To find the minimum or maximum element in a JavaScript array, use Math.min or Math.max with the spread operator.
Published   August 2, 2025
🌐
MathWorks
mathworks.com › matlab › data import and analysis › descriptive statistics
max - Maximum elements of array - MATLAB
If A is a matrix, then max(A) is a row vector containing the maximum value of each column of A. If A is a multidimensional array, then max(A) operates along the first dimension of A whose size does not equal 1, treating the elements as vectors. The size of M in this dimension becomes 1, while ...
🌐
YouTube
youtube.com › watch
How to Find Maximum and Minimum in an Array in JavaScript |Use Math.max() and Math.min() in JS - YouTube
Want to find the highest or lowest value in a JavaScript array? In this beginner-friendly tutorial, you'll learn how to find the maximum and minimum values i...
Published   July 6, 2025
🌐
Programiz
programiz.com › javascript › library › math › max
JavaScript Math max()
Here, ... is the spread operator that destructures the array and passes the array values as arguments to max(). The method then finds the smallest number. // max() with the string argument let numbers1 = Math.max("Dwayne", 2, 5, 79); console.log(numbers1);
🌐
SheCodes
shecodes.io › athena › 1878-using-math-max-to-find-maximum-value-in-javascript
[JavaScript] - Using `Math.max()` to Find Maximum Value in | SheCodes
Learn how to use the JavaScript Math.max() method to find the largest of zero or more numbers. Understand how to use `Math.max.apply()` with an array.
🌐
Jsremote
jsremote.jobs › tutorials › math-max
What is the Math.max() method in JavaScript? | Web developer jobs
For the most part, using the Math.max() function in JavaScript is easy and straightforward. Its primary use is to get the largest number of zero or more numbers. Don’t forget that you can utilize this function when working with arrays, making it a huge advantage for working with vast bulks of data.
🌐
MDN
mdn2.netlify.app › en-us › docs › web › javascript › reference › global_objects › math › max
Math.max() - JavaScript | MDN
Math.max(10, 20); // 20 Math.max(-10, -20); // -10 Math.max(-10, 20); // 20 · Array.reduce() can be used to find the maximum element in a numeric array, by comparing each value: var arr = [1,2,3]; var max = arr.reduce(function(a, b) { return ...
🌐
LaunchCode
education.launchcode.org › intro-to-professional-web-dev › appendices › math-method-examples › max-and-min-examples.html
Math.max and Math.min Examples — Introduction to Professional Web Development in JavaScript documentation
Math.max(x, y, z, ...) This method finds and returns the largest value from a set of numbers (x, y, z, ...). To find the maximum value in an array, see below. Example · console.log(Math.max(2, 3, 100.01, 0, -5.2, 100)); Console Output · 100.01 · The general syntax for this method is: Math.min(x, ...
🌐
freeCodeCamp
forum.freecodecamp.org › guide
JavaScript Math.max() Explained with Examples
September 8, 2019 - If a non-numeric value is passed as a parameter, Math.max() will return NaN . An array of numeric values can be passed as a single parameter to Math.max() using either spread (...) or apply .