Hi Rolfsf,

Instead of .slice(-1), you can use .filter(':last')


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Oct 24, 2007, at 3:53 PM, rolfsf wrote:



Thanks Josh & Andy!

I may not be able to upgrade to jQuery 1.2 right away - what's my
alternative for slice()?

r.


Andy Matthews-4 wrote:


This will give you the highest val without having to loop over the array:

var arr = new Array(6)
arr[0] = "10"
arr[1] = "5"
arr[2] = "40"
arr[3] = "25"
arr[4] = "1000"
arr[5] = "1"
arr[6] = "1001"

var largest = arr.sort(function(a,b){return a - b}).slice(-1)



--
View this message in context: http://www.nabble.com/help--- compare-3-lists%2C-get-the-largest-number-of-items...- tf4685230s27240.html#a13393735 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


Reply via email to