业务中经常有以下类似的代码场景,有更友好的写法推荐吗?_.forEach(this.updateTripInfoObj.people.data,(item,index)=>{if(item.name===val.name){this.updateTripInfoObj.people.data.splice(index,1);returnfalse;}returntrue;});
_.forEach(this.updateTripInfoObj.people.data,(item,index)=>{if(item.name===val.name){this.updateTripInfoObj.people.data.splice(index,1);returnfalse;}returntrue;});
if(item.name===val.name){this.updateTripInfoObj.people.data.splice(index,1);returnfalse;}returntrue;});
this.updateTripInfoObj.people.data.splice(index,1);returnfalse;}returntrue;});
returnfalse;}returntrue;});
}returntrue;});
returntrue;});
});
相关分类