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(...
🌐
W3Schools
w3schools.com › jsref › jsref_max.asp
JavaScript Math max() Method
❮ Previous JavaScript Math Object ... -10); let e = Math.max(1.5, 2.5); Try it Yourself » · 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
More on JavaScriptHow to Pass an Array From Java to JavaScript · In this traditional approach, we loop through each element in the array and compare it with a previously stored maximum value. If the current element is greater, we update our maximum. let numbers = [3, 7, 2, 8, 5]; let max = numbers[0]; // initialize to the first value for (let i = 1; i < numbers.length; i++) { if (numbers[i] > max) { max = numbers[i]; } } console.log(max); // Outputs: 8
🌐
Vultr Docs
docs.vultr.com › javascript › standard-library › Math › max
JavaScript Math max() - Find Maximum Value | Vultr Docs
November 27, 2024 - The method identifies 20 as the maximum value. Note that JavaScript treats 0 and -0 as equal, and both are considered less than any positive number. Understand that direct comparisons using Math.max() are typically more performant and concise ...
🌐
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.
🌐
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.
🌐
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 - Luckily, JavaScript's Math built-in object has got you covered. You can simply use Math.min() or Math.max() combined with the spread operator (...), as both functions accept any number of arguments.
Find elsewhere
🌐
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:
🌐
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 - That is because Math.min or Math.max functions expect distinct variables and not an array. So in order to do that before ES6/ES2015 apply method was used · var nums = [1, 2, 3] Math.min.apply(Math, nums) // 1 Math.max.apply(Math, nums) // 3 Math.min.apply(null, nums) // 1 Math.max.apply(null, nums) // 3 · With ES6/ES2016 destructuring assignment it becomes easier · The destructuring assignment syntax is a JavaScript expression that makes it possible to extract data from arrays or objects into distinct variables.
🌐
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
🌐
TechOnTheNet
techonthenet.com › js › math_max.php
JavaScript: Math max() function
In JavaScript, the syntax for the max() function is: Math.max([number1, number2, ... number_n]); ... Optional. The numbers that will be evaluated to determine the largest value.
🌐
Medium
medium.com › coding-at-dawn › the-fastest-way-to-find-minimum-and-maximum-values-in-an-array-in-javascript-2511115f8621
The Fastest Way to Find Minimum and Maximum Values in an Array in JavaScript | by Dr. Derek Austin 🥳 | Coding at Dawn | Medium
January 4, 2023 - Sometimes, given an array of numbers in JavaScript, the smallest or largest value needs to be identified — and quickly! There are several built-in ways to find a minimum or maximum value from an array in JavaScript, including using the Math functions with the spread operator (…) and sorting the array numerically with .sort().
🌐
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.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-max-element-in-an-array
JavaScript - Max Element in an Array - GeeksforGeeks
July 23, 2025 - The result is “-Infinity” if no arguments are passed and the result is NaN if at least one of the arguments cannot be converted to a number. The apply() function allows you to pass an array of arguments to the Math.max() function. JavaScript · const a = [22, 65, 1, 39]; console.log( Math.max.apply(null, a)); Output · 65 · The Javascript arr.reduce() method in JavaScript is used to reduce the array to a single value and executes a provided function for each value of the array (from left to right) and the return value of the function is stored in an accumulator.
🌐
AlgoCademy
algocademy.com › link
Max In Array in JavaScript | AlgoCademy
2. **Single Element Array**: The function should return the single element as the maximum value. 3. **All Negative Numbers**: The function should correctly identify the maximum value even if all numbers are negative.
🌐
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 …