xxxxxxxxxx
let fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort()
console.log(fruits)
// [ 'Apple', 'Banana', 'Mango', 'Orange' ]
xxxxxxxxxx
const sort = (arr) => arr.slice().sort(); // default sort
const sort = (arr) => arr.slice().sort((a, b) => a - b); // simple sort
const sort = (arr) => arr.slice().sort((a, b) => a.localeCompare(b, 'en', { sensitivity: 'base' })); // language-specific sort
xxxxxxxxxx
fun custom(a,b){
return (a.toLowerCase()>b.toLowercase()?1:-1'
}
fun sorting()P
var ep=Array.prototype.sort.call(arguments,custom);
}
var sortedArray=sortstring("Abc","abc","BCD","bcd",)
console.log(sortedArray);