I have the below object
members
{
[
age:30,
list: [
"PRICE",
"LIST",
"COUNTRY"
]
]
},
{
[
age:31,
list: [
"PRICE"
]
]
},
{
[
age:31,
list: [
"LIST"
]
]
}
I need to check if array values are equal to specific value.
I need to check if list has PRICE or list has COUNTRY or list has PRICE,LIST,COUNTRY combination.
Currently I'm using includes which checks if value is present. But i need to check exact value
Array.isArray(members.list.map(message, index){
if(message.includes("LIST"))
{
}
if(message.includes("PRICE"))
{
}
if(message.includes("PRICE") && message.includes("LIST") && message.includes("COUNTRY"))
{
//message.includes("PRICE") and ("LIST") is already executed, so this will execute again. But i need to execute the complete condition combination.
}
})
How to acheive this?
Array.isArray(members.list.map(...))makes not that much sense as.map()will always return an array O.oif(message.includes("PRICE") && message.includes("LIST") && message.includes("COUNTRY")) {} else if(message.includes("LIST")) {} else if(message.includes("PRICE")) { }