Best Way to compare a value in var with a list of values?

Hi

I need to compare a value (word) with a list of values (words).

If the value (word) is present in the list of values (words) do echo “Find It and run a command”

If the value (word) is NOT present in the list of values (words) do echo “Do Not Find It and run another command”

The compare function must be check in all list for every value saved in list.

What it the best solution do do this ?

Anyone can post a code please or link an example ?

Thanks, have a nice day

As starting point, have a look at arrays: How to store CSV in an array

{
“Command”: “executeScript”,
“Target”: “var arrMyMissingVals = []; {varArrayVals}.forEach(myArrayValue => { (!{varArrayAll}.includes(myArrayValue)) ? arrMyMissingVals.push(myArrayValue) : ‘’ }) ; return arrMyMissingVals”,
“Value”: “arrMyMissingVals”
},
{
“Command”: “if_v2”,
“Target”: “${arrMyMissingVals}.length != 0”,
“Value”: “----------- VALUE FOUND”
},

{
“Command”: “end”,
“Target”: “”,
“Value”: “----------- END VALUE FOUND”
},