// 需求:根據Id取出數組中指定的對象 let arr = [ { id: 1, rotationAngle: 330, target: '目標1' }, { id: 2, rotationAngle: 270, target: '目標2' }, { id: 3, rotationAngle: 210, target: '目標三' }, ] function getTargetObjById (id) { return arr.find(item => item.id === id) } console.log(getTargetObjById(2)) // { id: 2, rotationAngle: 270, target: '目標2' },