1 let a = [1, 2, 3, 4, 5]; 2 let arr = a.splice(2, 1); // 剩余數組 3 let content = arr[0]; // 目標元素 4 5 console.log('初始化', a) 6 console.log('剩余數組 ', arr) 7 console.log('目標元素', content) 8 // 置頂 9 a.unshift(content); 10 console.log('置頂',a) 11 12 // 上移 13 a.splice(1, 0, content) 14 console.log('上移',a) 15 16 // 下移 17 a.splice(3, 0, content) 18 console.log('下移', a)