slice():從數組中返回選定(擷取)的元素,作為一個新數組。

slice():從數組中返回選定(擷取)的元素,作為一個新數組。

參數(開始,結束但不包括)

const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
const citrusSlice = fruits.slice(1, 3);
//Orange,Lemon