I have a JSON object that has an array as below
{
"objects": [
{
"severity": "LOW",
"tags": [
{
"key": "account",
"values": [
"account2"
]
},
{
"key": "accountId",
"values": [
"2"
]
}
],
"name": "object1"
},
{
"severity": "HIGH",
"tags": [
{
"key": "account",
"values": [
"account2"
]
},
{
"key": "accountId",
"values": [
"2"
]
}
],
"name": "object2"
},
{
"severity": "MEDIUM",
"tags": [
{
"key": "account",
"values": [
"account44"
]
},
{
"key": "accountId",
"values": [
"44"
]
}
],
"name": "object2"
},
{
"severity": "HIGH",
"tags": [
{
"key": "account",
"values": [
"account42"
]
},
{
"key": "accountId",
"values": [
"42"
]
}
],
"name": "object2"
}
]
}
I want to be able to go through the array using javascript and if severity is HIGH and acccountID matches 2 for example to set a warning. Even though account 2 might have a severity of LOW as shown, I still want to make the if condition true.
So something like if (objects.some(a =>(a.severity ==="LOW" && ...... or whatever better option there is.
||) operator. developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…