var arrayX = ['c','b','a','z'];
document.write(arrayX + "<br />")
document.write(arrayX.sort())
var array = [5,4,3,2,1,9,8,10];
document.write(array + "<br />")
document.write(array.sort() + "<br />")
function sortNumber(a,b)
{
return a - b;
}
document.write(array.sort(sortNumber))
function sortNumber2(a,b)
{
return parseInt(a) > parseInt(b);
}
var array = ['5','4','3','2','1','9','8','10'];
document.write(array + "<br />")
document.write(array.sort(sortNumber2) + "<br />")
function sortByOrder(a,b){
return parseInt(a.labelOrder) > parseInt(b.labelOrder);
}
array.sort(sortByOrder);
function sortBy(field){
return function(a,b){
return parseInt(a[field]) - parseInt(b[field]);
}
}