Sorting - JavaScript

function onButtonClick() {
    var fruits = ['Banana', 'Orange', 'Apple', 'Mango'];
    alert(fruits.sort(sortDescending));
}
function sortAscending(a, b){
    if (a == b) return 0;	
    if (a > b) return 1;	
    return -1;
}
function sortDescending(a, b){
    return -1 * sortAscending(a, b);
}