Answer the question
In order to leave comments, you need to log in
How to sort an array by number of characters?
There is such an array.
You need to sort it from largest to smallest by the number of characters.
accords: [
"A\#", "A", "A7", "A\#m", "Am", "Ab",
"B","B7", "Bm", "Bb",
"C\#", 'C', 'C7', 'Cm', 'C\#m',
"D\#", 'D', 'D7', 'Dm', 'D\#m', "Db",
'E', 'E7', 'Em', "Eb",
"F\#", 'F', 'Fm', 'F\#m', 'F7',
"G\#", "G", "Gm", "G\#m", "Gb", "G7",
"H", "Hm", "Hb", "H7"]
return this.accords.sort(
function(a, b){
return b.length > a.length;
}
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question