![]() |
|
|
+ Search |
![]()
|
Mar 13th, 2000 04:39
Martin Honnen,
Use a suitable comparison function e.g.
function compareLength (el1, el2) {
return el1.length - el2.length;
}
which you pass to the Array sort method:
//example
var a = new Array('Kibology', 'Maho', 'K')
a.sort(compareLength);
alert(a)