100分,JS问题,在线等待。
- JScript code
var obj = [Object object, Object object, Object object, Object object, Object object];// 每一个Object中都有一个Id,name。 我如去匹配何删除id=0,id = 2 ,所在的对象。
[解决办法]
for(i=obj.length-1;i>-1;i--)
{
if(obj[i].Id=="0" || obj[i].Id=="1")
{
obj.splice(i,1);
}
}
[解决办法]
- JScript code
var obj = [Object object, Object object, Object object, Object object, Object object];var obj2 = [];//放置所有被删除之后剩余的元素var obj3 = [];//放置所有满足删除条件,需要删除的元素for(var i = 0 ; i < obj.length ; i ++){if(obj[i].id != "0" && obj[i].id != "2"){obj2.push(obj[i]);}else{obj3.push(obj[i]);}}