Assume we have set of number in an array
var dataArray = [23,76,33,99,66,22,66,44];
Now i want to get the min among the above array, the traditional way is to loop through and get the minimum element but using apply function we have to write only one line of code.
alert(Math.min.apply(null, dataArray)); //This would return 22 alert(Math.max.apply(null, dataArray)); //This would return 99
- How to make sequential ajax call