I am facing an issue where I have a list of values stored in a comma-separated string and I need to compare them against an array to see if any match. The goal is to return true or false, but I keep getting an undefined error.
const reqRights = ["18900253","3217840","1053"];
const groups = "3217635,18272308,1053,3217633,18900253,3217698,3217699,3217840,10162510";
function checker(value) {
var groups = groups.split(",");
console.log(groups);
return groups.every(function(v) {
return value.indexOf(v) !== -1;
});
}
arr = reqRights.filter(checker);
console.log(arr);
It's important to note that the js engine SpiderMonkey 1.8 does not support .includes and some methods