//从第三个位置开始,删除2项$(document).ready(function(){ var arr = [1,2,3,4,5,6,7,8,9,10]; arr.splice(3,2); console.log(arr);});//从第一个位置,添加2项,即数组最前端加55和66var arr1 = [1,2,3,4,5,6,7,8,9,10];arr1.splice(0,0,55,66);console.log(arr1);//从第一个位置,删除一项,添加2项var arr2 = [1,2,3,4,5,6,7,8,9,10];arr2.splice(0,1,55,66);console.log(arr2);
代码片断清楚的说明了2个参数及2+个参数的用法