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
The Math.max() static method returns the largest of the numbers given as input parameters, or -Infinity if there are no parameters. 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(...
🌐
Built In
builtin.com › articles › javascript-array-max
3 Methods to Find the JavaScript Array Max | Built In
JavaScript’s Math.max() can find the maximum among individual numbers. However, when combined with the spread operator, it can find the maximum in an array, making this method both concise and efficient.
🌐
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 - This approach is concise, readable, and leverages JavaScript’s built-in mathematical functions for optimal performance. Use Math.max() with the spread operator to find the largest value in an array.
🌐
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 - For loop will iterate over the array and compare each element to find the maximum value: const arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3]; let max = arr[0]; for (let i = 1; i < arr.length; i++) { if (arr[i] > max) { max = arr[i]; } } console.log(max); // Output: 9 · The sort() method is a built-in JavaScript method that sorts the elements of an array.
🌐
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
🌐
W3Schools
w3schools.com › jsref › jsref_max.asp
JavaScript Math max() Method
The Math.max() method returns the number with the highest value. ... Math.max() is an ECMAScript1 (JavaScript 1997) feature. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: ...
🌐
danvega.dev
danvega.dev › blog › find-max-array-objects-javascript
How to find the max id in an array of objects in JavaScript
March 14, 2019 - While I like the map and reduce approach much better than iterating over the array it still doesn't feel great to me. If you dig into Math.max you will find out that it can take a list of numbers or an array of numbers.
Find elsewhere
🌐
30 Seconds of Code
30secondsofcode.org › home › javascript › array › min and max value of an array
Min and max value of a JavaScript array - 30 seconds of code
December 30, 2023 - If n is greater than or equal to the length of the array, we'll get the original array back. const minN = (arr, n = 1) => [...arr].sort((a, b) => a - b).slice(0, n); const maxN = (arr, n = 1) => [...arr].sort((a, b) => b - a).slice(0, n); minN([1, 2, 3]); // [1] minN([1, 2, 3], 2); // [1, 2] maxN([1, 2, 3]); // [3] maxN([1, 2, 3], 2); // [3, 2] For more complex cases, such as finding the min/max value in an array of objects, you will have to use Array.prototype.map().
🌐
Vultr Docs
docs.vultr.com › javascript › standard-library › Math › max
JavaScript Math max() - Find Maximum Value | Vultr Docs
November 27, 2024 - The Math.max() method in JavaScript is a straightforward yet powerful tool used to determine the maximum value among its given arguments. By accepting multiple numbers or an array of numbers (with a spread operator), this method evaluates and ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-max-element-in-an-array
JavaScript - Max Element in an Array - GeeksforGeeks
July 23, 2025 - ... let a = [22, 65, 1, 39]; let i; let max = a[0]; for (i = 1; i < a.length; i++) { if (a[i] > max) max = a[i]; } console.log(max); ... The JavaScript Math max() Method is used to return the largest of zero or more numbers.
🌐
W3docs
w3docs.com › javascript
How to Find the Min/Max Elements in an Array in JavaScript
Javascript Math.max.apply find max element in array · let arrayOfNumbers = [4, 12, 62, 70, -10]; console.log(Math.max.apply(Math, arrayOfNumbers)); // returns 70 ... The spread operator is also used to get the maximum of an array. It expands an array of numbers into the list of arguments, such as with Math.min() and Math.max() :
🌐
W3Resource
w3resource.com › javascript-exercises › javascript-math-exercise-6.php
JavaScript Math: Find the highest value in an array - w3resource
Write a JavaScript function to find the highest value in an array. Test Data : console.log(max([12,34,56,1])); console.log(max([-12,-34,0,-56,-1])); 56 0
🌐
DEV Community
dev.to › domhabersack › getting-the-largest-number-from-an-array-e97
🔥 Getting the largest number from an array - DEV Community
January 5, 2021 - In your example, you probably want to use Number.NEGATIVE_INFINITY instead of 0 as the initial value in case there are only negative values in the array. You can just pass it a single argument. I tried that at first but changed it because I thought that was causing my error, but then I figured out it was actually reduce passing additional garbage to Math.max. I wouldn’t call JavaScript “insane” because it does some things differently.
🌐
Seanconnolly
seanconnolly.dev › javascript-find-element-with-max-value
How to get the element with the max value in a JavaScript array · Sean Connolly
Array.find is a very useful function but only if you can determine whether or not you have the right item independently from other items in the array, e.g. finding the player named Leanne Graham: const leanne = players.find(p => p.name === "Leanne Graham"); Math.max could be used if you only cared about the value instead of the item that holds the value, e.g. finding the max number of wins:
🌐
Programiz
programiz.com › javascript › library › math › max
JavaScript Math max()
// max() with the string argument let numbers1 = Math.max("Dwayne", 2, 5, 79); console.log(numbers1); // max() with character arguments let maxNum = Math.max('A', 'B', 'C'); console.log(maxNum); // Output: // NaN // NaN · In the above example, we have used the max() method with the string ...
🌐
Stack Abuse
stackabuse.com › javascript-get-min-and-max-element-of-array
JavaScript: Get Min and Max Element of Array
April 6, 2023 - We'll also look at four different methods and compare their speeds when dealing with large arrays. Math is JavaScript's built-in global convenience object containing a lot of methods and constants you might need when performing mathematical operations. Two methods that we'll use in this article are Math.min() and Math.max() - both of them accept a list of numbers as arguments.
🌐
GeeksforGeeks
geeksforgeeks.org › find-the-min-max-element-of-an-array-using-javascript
Find the min/max element of an Array using JavaScript | GeeksforGeeks
To find the minimum or maximum element in a JavaScript array, use Math.min or Math.max with the spread operator.
Published   January 7, 2025
🌐
Medium
medium.com › @vladbezden › how-to-get-min-or-max-of-an-array-in-javascript-1c264ec6e1aa
How to get min or max of an array in JavaScript | by Vlad Bezden | Medium
September 2, 2016 - How to get min or max of an array in JavaScript max function of Math object The Math.max() function returns the largest of zero or more numbers. and min function of Math object The Math.min() …