var parts = [‘shoulders‘, ‘knees‘]; var lyrics = [‘head‘, ...parts, ‘and‘, ‘toes‘]; // ["head", "shoulders", "knees", "and", "toes"] var arr1 = [0, 1, 2]; var arr2 = [3, 4, 5]; arr1.push(...arr2); // [0,1,2,3,4,5 function myFunction(v, w, x, y, z) { console.log(v, w, x, y, z); } var args = [0, 1]; myFunction(-1, ...args, 2, ...[3]);] //-1, 0 , 1, 2, 3
时间: 2024-10-12 20:46:16