从对象中删除数组组件

remove array component from object

我有一些包含数组的复杂组件

this.SomeComponent.subArray

SomeComponent:model1;

模型 1 定义:

someString1:string;
someString2:string;
someString3:string;
subArray[]

模型 2 定义:

someString22:string;
someString23:string;
someString24:string;

现在如果我console.log(JSON.stringify(this.SomeComponent.subArray)); 我得到:

SomeComponent[{"someString22":"one","someString23":"yellow","someString24":"water",},
{"someString22":"two","someString23":"red","someString24":"ground",}
{"someString22":"three","someString23":"green","someString24":"air",}]

现在我的任务是删除 subArray 部分,其中有 someString23==red。 所以当我下次控制台日志时,我必须只得到这个

SomeComponent[
    {"someString22":"two","someString23":"red","someString24":"ground",}
    {"someString22":"three","someString23":"green","someString24":"air",}]

我该怎么做?

使用如下过滤方法:-

this.subArray = subArray.filter((item) => item["someString23"]!==red);