将数组中 id:4 项,放置数组的第一位
let arr = [{id:1,name:"a"}, {id:4,name:"bb"},{id:8,name:"gg"}, {id:3,name:"jjj"}];
console.log("原本数组:",arr)
let index = arr.findIndex(item => item.id === 4)
let mateItem = arr.splice(index,1)
arr.splice(0,0,...mateItem)
console.log("将匹配项放置数组第一位后的数组:",arr)