javascript 数组里面的对象变成了undefined
在调用下面的remove方法的时候,传了个【[object],[object],[object]】,执行了以后,数组变成了【undefined,[object],[obj...
在调用下面的remove 方法的时候,传了个【[object] , [object],[object]】,执行了以后,数组变成了【undefined,[object],[object]】.求解!!!
function remove(array,index)
{
alert("remove been called!");
alert("index:"+index+" , array.length:"+array.length);
for(;index<array.length;index++)
{
var error_msg="";
for(var a=0;a<methodArray.length;a++)
{
error_msg+=methodArray[a]+"\n";
}
alert(error_msg);
if(index!=array.length-1)
{
alert("remove the attribute in array");
array[index]=array[index+1];
}
else
{
alert("reduce the length");
array.length=array.length-1;
}
}
alert("The length after remove is : "+array.length);
} 展开
function remove(array,index)
{
alert("remove been called!");
alert("index:"+index+" , array.length:"+array.length);
for(;index<array.length;index++)
{
var error_msg="";
for(var a=0;a<methodArray.length;a++)
{
error_msg+=methodArray[a]+"\n";
}
alert(error_msg);
if(index!=array.length-1)
{
alert("remove the attribute in array");
array[index]=array[index+1];
}
else
{
alert("reduce the length");
array.length=array.length-1;
}
}
alert("The length after remove is : "+array.length);
} 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询