How to sort a json object by numeric sorting method [closed]

I am having an object with the display value as a string having numbers in it
I want the values to be sorted by Numeric sorting and not alphabetic sorting

Let jsonObj = [{ displayValue : 'B1'}, {displayValue : 'A3'},{ displayValue : 'D1'}, {displayValue : 'C2'}, {displayValue: 'A4'}, {displayValue: 'D3'}];

so the output should have B1, D1, C2, A3, A4

Can any one help me out with the logic for numeric sorting Any help is appreciated

Thanks in Advance

Answer

this will sort the array as you want:

array.sort((a, b) => +a.displayValue.match(/d+/)[0] - +b.displayValue.match(/d+/)[0] > 0 ? 1 : -1);