我可以在Javascript中的过滤器函数中使用two-includs方法吗



我可以在Javascript中的筛选函数中使用two-includs方法吗?

我想要一个没有这些状态("活动"、"退款"(的新数组。我怎样才能做到这一点?我曾考虑使用两个include方法,但似乎不起作用。

const availableModules = [
{
key: "tshirt",
color: "#305b2d",
status: "active",
modules: 
[
{ key: "tshirt",
color: "#066da0",
status: "active step 2"}, 
{  key: "tshirt",
color: "#772016",
status: "active step 3"}
],
},
{
key: "tshirt",
color: "#742016",
status: "canceled",
},
{
key: "hat",
color: "#201010",
status: "refunded",
},
{
key: "short",
color: "#702213",
status: "delivered",
},
{
key: "short",
color: "#702010",
status: "Pending",
},
{
key: "shirt",
color: "#702411",
status: "Closed",
},
];

const seeOther = availableModules.filter(m=> console.log(!m.status.includes('active', 'refunded')))

你试过这样的吗

availableModules.filter(x => ((x.status !== "active") && (x.status !== "refunded")))

最新更新