I have a simple JavaScript Array object containing a few numbers.
[267, 306, 108]
Is there a function that would find the largest number in this array?
I have a simple JavaScript Array object containing a few numbers.
[267, 306, 108]
Is there a function that would find the largest number in this array?
Resig to the rescue:
Finding max and min value the easy and manual way. This code is much faster than
Math.max.apply
; I have tried up to 1000k numbers in array.You can try this,
Find Max and Min value using Bubble Sort
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max
Don't forget that the wrap can be done with
Function.prototype.bind
, giving you an "all-native" function.