2
有沒有一種方法(就像我們在C#中的generics/linq list.take ...),它可以在調用函數時在參數中獲取數組元素的一個元素,而不必創建一個新的數組?JavaScript在參數中傳遞新數組
//a simple array with some elements
myArray;
//just to show what I mean...pass the first five elemtns of array to the function
doSomethingWithArray(myArray[0,4]);
function doSomethingWithArray(items) {
//do stuff
}