Assume I have this arrray: ['a', 'c', 'bb', 'aaa', 'bbb', 'aa']. I want to sort it in this way:
aaa, aa, a, bbb, bb, c.
this.array= this.array.sort((n1, n2) => n1.localeCompare(n2));
this.array= this.array.sort((n1, n2) => n2.length - n1.length);
But this is not right. How can I fix it?