菜单

splice数组替换


最后更新:2020-01-18 22:07


简介:
splice(start,deleteCount,val1,val2,...) 从下标为start开始删除deleteCount个元素,并在该位置添加val,val2 var a = [1,2,3,4,5];var b = a.splice(2,2,7,8,9); //a:1,2,7,8,9,5


function f5iNjMcDPt(start,count,a,b){  
  a.splice(start,count,b);
  return a;  
}              
测试