we can sort the array using sort() in javascript, by default it sorts the array by ascending order,if you want it in descending order user reverse() function
var myarray=["new york", "california", "ohio"] myarray.sort() // sorts in ascending order
myarray.reverse() //descending order
we can sort the array using
Mon, 11/17/2008 - 22:38 — adminwe can sort the array using sort() in javascript, by default it sorts the array by ascending order,if you want it in descending order user reverse() function
var myarray=["new york", "california", "ohio"]
myarray.sort() // sorts in ascending order
myarray.reverse() //descending order