CodePudding user response:
Var array=[' wuhan ', 'Beijing', 'Shanghai', 'tianjin'].Var resultArray=array. Sort (
The function compareFunction (param1, param2) {
Return param1. LocaleCompare (param2, "useful");
}
);
The console. The log (resultArray);