重新排序多维对象

时间:2016-09-06 16:23:20

标签: javascript sorting oop object

我应该根据维度的索引对多维对象进行排序,同时保留相应的索引。

实际物体结构

object1[index1][index2][index3][index4][index5]

目前的分类优先(视觉上)

1st
[index1]
2nd
[index2]
3rd
[index3]
4th
[index4]
5th
[index5]

示例(当前分类)

1st - object1['1']['50']['0']['0.00']['ARTICOLO3']
2nd - object1['1']['51']['0']['0.00']['ARTICOLO2']
3rd - object1['1']['52']['0']['0.00']['ARTICOLO1']

重新分类预期

1st
[index4]
2th
[index5]
3rd
[index3]
4th
[index1]
5th
[index2]

示例(按INDEX5重新分类)

1st - object1['1']['52']['0']['0.00']['ARTICOLO1']
2nd - object1['1']['51']['0']['0.00']['ARTICOLO2']
3rd - object1['1']['50']['0']['0.00']['ARTICOLO3']

0 个答案:

没有答案