需要从下面过滤fieldvalue
Need to filter fieldvalue from the below
我想从下面的数组中过滤掉字段值和大于3的字段值字符的长度。请帮忙解决这个问题
[
{
"fieldName": "",
"fieldValue": "",
"OrderbyFieldName": "",
"OrderbyDesc": false
},
{
"fieldName": "Selection",
"fieldValue": "b",
"OrderbyFieldName": "",
"OrderbyDesc": false
}
]
您可以使用 Array.filter
来做到这一点。
const filteredData = data.filter(item => item.fieldValue?.length >= 3);
我想从下面的数组中过滤掉字段值和大于3的字段值字符的长度。请帮忙解决这个问题
[
{
"fieldName": "",
"fieldValue": "",
"OrderbyFieldName": "",
"OrderbyDesc": false
},
{
"fieldName": "Selection",
"fieldValue": "b",
"OrderbyFieldName": "",
"OrderbyDesc": false
}
]
您可以使用 Array.filter
来做到这一点。
const filteredData = data.filter(item => item.fieldValue?.length >= 3);