2023-01-19 Vue pop()刪除最後一個元素並返回該元素 pop()刪除最後一個元素並返回該元素 const plants = ['broccoli', 'cauliflower', 'cabbage', 'kale', 'tomato']; console.log(plants.pop()); // "tomato" console.log(plants); // ["broccoli", "cauliflower", "cabbage", "kale"] Newer push():將一個或多個元素添加到數組 Older keys():返回一個新的Array Iterator對象,其中包含數組中每個索引的鍵