数组元素按指定的位置排序
var pageIds = [3, 1, 2,6,4,5,0];
var arr = [
{
applicationName: "我的订单",
id: 0,
},
{
applicationName: "我的绩效",
id: 1,
},
{
applicationName: "车险续保",
id: 2,
},
{
applicationName: "我的团队",
id: 3,
},
{
applicationName: "客户管理",
id: 4,
},
{
applicationName: "保单批改",
id: 5,
},
{
applicationName: "在线学习",
id: 6,
},
]
var result = []
for (let i = 0; i < pageIds.length; i++) {
result = result.concat(arr.filter(m => m.id === pageIds[i]))
}
console.log(result)