, , . , :
const sortValues = arr.map(elt => elt.replace(/"/g, ''));
, 0 :
const sortIndexes = arr.map((_, i) => i)
.sort((a, b) => sortValues[a].localeCompare(sortValues[b]));
Then reorder the input array based on the sorted indices:
const result = sortIndexes.map(i => arr[i]);
user663031
source
share