日期:2014-05-16 浏览次数:20552 次
var $a =[1,2,3];
var $b = [4,5,6];
$b.unshift(0,0);
//$a.splice(0,0,'jiang',6,9);
Array.prototype.splicexx = function(start,deletecount){
var items,len1,lenthis,cloneitem,newitem;
newitem = [];
items = Array.prototype.slice.call(arguments,2);
len1 = items.length;
lenthis = this.length;
for(var i=0;i<lenthis;i++){
if(i == start){
for(var j=0;j<len1;j++){
newitem.push(items[j]);
}
for(var k=0;k<deletecount;k++){
i++;
}
}
newitem.push(this[i]);
}
return newitem;
}
var $c = $a.splicexx.apply($a,$b);
var $x = 'ddd';