blog post

Sometimes, however, you need to pick the smallest or the biggest number from an array. In this case it’s your responsibility to provide such min/max functions. Clever usage of apply allows you to use built-ins functions for some tasks that otherwise probably would have been written by looping over the array values. As an example here we are going to use Math.max/Math.min to find out the maximum/minimum value in an array.

Source Code

<script src="//"></script>
<body style="text-align:center;">
<h2>Min OR Max Get From Array</h2>


var minMath = function (arr) {
      return Math.min.apply(Math, arr);
    var maxMath = function (arr) {
      return Math.max.apply(Math, arr);


var numbers=[1,2,3,4,5,6,7,8,9,10]

$("#min").html('<b>Min Number is </b>: '+minMath(numbers));
$("#max").html('<b>Max Number is: </b>'+maxMath(numbers));

<pre>var numbers=[1,2,3,4,5,6,7,8,9,10];</pre>
<div id="min"></div>
<div id="max"></div>

Max and Min value of array in JQuery
  • Share This Story

Pleas give your valuable comments to improve the contents.

about author

Atul kumar shukla

I'm Atul Kumar Shukla, working as a web developer.
Welcome to my Blog. This is my personal blog where i post my own questions and answers , articles about ASP.Net., SQL Server, HTML, CSS, Jquery and many more..

Visit Profile

Leave a comment


Get More Stuff
Subscribing to the TheOneblogs newsletter and get intersting stuff and updates to your email inbox.
Your Email


Style Switcher

Change Color

×! We use cookies to improve your user experience. More information