sort([compareFunction])

Sort the array items according to a compare function. If the function is not supplied, all items are sorted as strings. A compare function is a function that accepts two parameters. It returns a positive number if the first parameter is greater than the second parameter, zero if the two parameters are the same and a negative number if the first parameter is less than the second parameter.

Examples

function compareInt(a, b) {

  return a - b;

}

array1.sort(compareInt);

<< slice(begin[, end]) © 1996-2013 InetSoft Technology Corporation (v11.4) join(separator) >>