For example, give a specific alphabetical order, "a", "O", "E", "U", "Y", "I", please sort the 7 strings of ' Aiye ', ' oeu ', ' ayo ', ' Eoyiu ', ' yuo ', ' You ', ' Iao ' in the given alphabetical order.
My idea is to give those 6 letters equivalent to 0-5, and then replace the letters in the 7 strings with the numbers in 0-5, then sort them by the sort method as follows:
var word = [' Aiye ', ' oeu ', ' ayo ', ' Eoyiu ', ' yuo ', ' You ', ' Iao '];
var obj = {A:0,o:1,e:2,u:3,y:4,i:5};
var obj1 = {0: ' A ', 1: ' O ', 2: ' E ', 3: ' U ', 4: ' Y ', 5: ' I '};
For (var index in Word) {
var word1 = Word[index];
var word3 = "";
for (var i = 0; i< word1.length i + +) {
Word3 + = Obj[word1[i]];
};
Word[index] = Word3
}
Word.sort ();
For (var index in Word) {
var word1 = Word[index];
var word3 = "";
for (var i = 0; i< word1.length i + +) {
Word3 + = Obj1[word1[i]];
};
Word[index] = Word3
}
Console.log (word);