Check a string against a JSON decoded string

Hello,

I have 1) a comma delimited string that is the result of a JSON decode and 2) an array composed of various strings.

I want to see which elements of the array are also found in the comma delimited string.


//var myarray;
//var jsondecoded;
for (var k in myarray) {
  if(myarray[k] isFoundIn jsondecoded) {
    //do something
  }			
}

Obviously, the isFoundIn bit doesn’t work… Anyone know how I should proceed?

:slight_smile:

Give the in operator a try https://developer.mozilla.org/en/JavaScript/Reference/Operators/in