Home > other >  Need to filter fieldvalue from the below
Need to filter fieldvalue from the below

Time:06-03

I want to filter the fieldvalue and the length of the filedvalue character greater than 3 from the below array. Please help with this

[
    {
        "fieldName": "",
        "fieldValue": "",
        "OrderbyFieldName": "",
        "OrderbyDesc": false
    },
    {
        "fieldName": "Selection",
        "fieldValue": "b",
        "OrderbyFieldName": "",
        "OrderbyDesc": false
    }
]

CodePudding user response:

You can use Array.filter to do just that.

const filteredData = data.filter(item => item.fieldValue?.length >= 3);
  • Related