Say I have an array that looks like this:
$array = ['xl', 's', '1', '10', '3', 'xs', 'm', '3T', 'xxl', 'xxs', 'one size'];
I want to sort the array to look like this:
$sortedArray = ['1', '3', '3T', '10', 'one size', 'xxs', 'xs', 's', 'm', 'xl', 'xxl'];
How could I possibly sort this array in javascript?
I can spot a pattern so that helps me get on the right track, but I can't figure out the sort function. A pattern being all sizes that start with a number are first, ordered numerically (but not sure how '3T' handles that). And then we show 'one size', and then we sort the rest (XXS, XS, S, M, L, XL, XXL) based on a predefined order.