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
console.log(Math.max(1, 3, 2)); // Expected output: 3 console.log(Math.max(-1, -3, -2)); // Expected output: -1 const array = [1, 3, 2]; console.log(Math.max(...array)); // Expected output: 3 · js · Math.max() Math.max(value1) Math.max(value1, value2) Math.max(value1, value2, /* …, */ valueN) value1, …, valueN ·
🌐
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.
🌐
W3Schools
w3schools.com › jsref › jsref_max.asp
JavaScript Math max() Method
The Math.max() method returns the number with the highest value.
🌐
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....
🌐
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);
🌐
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
Find elsewhere
🌐
Math.js
mathjs.org › docs › reference › functions › max.html
math.js | an extensive math library for JavaScript and Node.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
🌐
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.
🌐
TutorialsPoint
tutorialspoint.com › javascript › math_max.htm
JavaScript Math.max() Method
The spread operator will destructure the array and then this method finds the largest number. Here, we are passing string and character arguments to this method − · <html> <body> <script> let number1 = Math.max("John", 30, 50, 90); document.write(number1, "<br>"); let number2 = Math.max("John", "Smith", "Candice", "Alisa"); document.write(number2); </script> </body> </html>
🌐
CoreUI
coreui.io › answers › how-to-find-the-maximum-value-in-an-array-in-javascript
How to find the maximum value in an array in JavaScript · CoreUI
September 21, 2025 - Use Math.max with spread operator to efficiently find the largest number in a JavaScript array with modern syntax.
🌐
TechOnTheNet
techonthenet.com › js › math_max.php
JavaScript: Math max() function
var totn_array = [5, 10, 15, 20, 25]; console.log(Math.max(...totn_array)); The following will be output to the web browser console log: 25 · In this example, the max() method returned 25 which is the largest value from the array called totn_array. This array consisted of 5 elements with the numeric values: 5, 10, 15, 20 and 25. NEXT: min · Share on: SQL · Oracle / PLSQL · SQL Server · MySQL · MariaDB · PostgreSQL · SQLite · Excel · Access · Word · HTML · CSS · JavaScript ·
🌐
freeCodeCamp
forum.freecodecamp.org › guide
JavaScript Math.max() Explained with Examples
September 8, 2019 - Math Max Math.max() is a function that returns the largest value from a list of numeric values passed as parameters. If a non-numeric value is passed as a parameter, Math.max() will return NaN . An array of numeric …
🌐
Medium
medium.com › @amitsharma_24072 › 3-efficient-ways-to-find-maximum-value-in-javascript-arrays-515463ebd17
3 Efficient Ways to Find Maximum Value in JavaScript Arrays | by Amit Sharma | Medium
July 11, 2024 - By using the spread operator (…) and applying it to the array: const arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3]; const max = Math.max(...arr); console.log(max); // Output: 9
🌐
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 ...
🌐
Scaler
scaler.com › home › topics › math max javascript
Math Max Javascript - Scaler Topics
May 4, 2023 - If we have our array and we want to find the maximum element of that array, we can use a reduced higher-order function along with Math.max() to achieve the solution to this problem.