我有一些數據在followng方式構造:排序數據0
theArray = [
0:[
0 : {},
1 : {},
2 : {},
3 : {},
status : {
started : 5,
finished : 7
}
],
1:[
0 : {},
1 : {},
2 : {},
3 : {},
status : {
started : 0,
finished : 3
}
],
2:[
0 : {},
1 : {},
2 : {},
3 : {},
status : {
started : 3,
finished : 1
}
],
3:[
0 : {},
1 : {},
2 : {},
3 : {},
status : {
started : 0,
finished : 7
}
],
4:[
0 : {},
1 : {},
2 : {},
3 : {},
status : {
started : 4,
finished : 0
}
]
]
我想通過status.started
重新排列內theArray
陣列,使之與任何status.started === 0
陣列是推到底部。所以theArray
應該是這樣的:
theArray = [
0:[
0 : {},
1 : {},
2 : {},
3 : {},
status : {
started : 5,
finished : 7
}
],
1:[
0 : {},
1 : {},
2 : {},
3 : {},
status : {
started : 3,
finished : 1
}
],
2:[
0 : {},
1 : {},
2 : {},
3 : {},
status : {
started : 4,
finished : 0
}
],
3:[
0 : {},
1 : {},
2 : {},
3 : {},
status : {
started : 0,
finished : 3
}
],
4:[
0 : {},
1 : {},
2 : {},
3 : {},
status : {
started : 0,
finished : 7
}
]
]
我想最好想如果可能使用Underscore.js。過去永遠不會讓我失望!
這不是事件有效的JavaScript ... – meskobalazs
@meskobalazs是不是? – gcampbell
''''或'{'........... –