I have an array with the following dimensions:
var arr = [
'small',
'small',
'small',
'small',
...
'medium',
'medium',
'medium',
'medium',
...
'big',
'big',
...
];
I need to reorganize this array according to this order:
var order = ['small', 'small', 'medium', 'medium', 'big'];
Thus, the result ends approximately as follows:
var arr = [
'small',
'small',
'medium',
'medium',
'big',
'small',
'small',
'medium',
'medium',
'big'
...
];
I know about other similar issues in SO, but haven’t found anything yet. I do not know how to approach this. I thought I sortshould do, but what am I testing? It seems simple, but I'm stuck, I don't know where to start. Any clues?