const input = ["a1b2", "c3d", "e5f6g", "xyz", "123", "a3"];
const processArray = (arr) => {
const convert = ["one", "two", "three", "four","five","six","seven", "eaight", "nine"]
arr.sort((a,b)=> {
console.log(a,b)
if(a.toLowerCase() < b.toLowerCase()){
return -1
}
return 1
})
const result = []
for(val of arr){
let isNumber = false
let str = ""
for(char of val){
if(!isNaN(char)){
isNumber = true
str = str + convert[+char - 1]
}else{
str = str + char
}
}
if(isNumber){
result.push(str)
isNumber = false
str = ""
}
}
return result
}
const result = processArray(input);
console.log(result); // Output: ["onetwothree", "three", "aonebtwo", "cthree", "efivegsix"]
To embed this project on your website, copy the following code and paste it into your website's HTML: