1

Hi I'm not sure if I have explained the question properly through the title but I have an Array of Strings as such:

["item2:apple", "item0:raddish", "item1:orange"]

I would like to sort this Array by the "itemx" value in the strings.

So the end result would be as such:

["item0:raddish", "item1:orange", "item2:apple"]

I'm unable to do so with the standard Array.sort();

Could I get some help please, thanks!

SunAwtCanvas
  • 1,261
  • 1
  • 13
  • 38
  • 1
    `array.sort((a,b) => a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'}))` – adiga Apr 15 '21 at 07:53

0 Answers0