const sort = str => str.split('').sort((a, b) => a.localeCompare(b)).join('');
// Example:
sort('eat');
// Output:
// 'aet'
letterArr.sort();
// OR
letterArr.sort( (a,b) => {
return a<b ? -1 : 1;
});
let arr = [
[10, 2],
["a",3],
[2.2, "d","h",6,"s",14,1],
["f", "e"],
["p","y","z","V"],
[5]
]
let val = arr.flat()
val = [
...val.filter(v => typeof v === "number").sort((a, b) => a - b),
...val.filter(v => typeof v === "string").sort()
]
console.log(val)