I have this targetPageParamsAll() in the AEM page which would return the user groups as an array.
targetPageParamsAll = function() {
var userGroups = "everyone,test1,test2,beta1";
var userGroups = userGroups.split(",");
return {
"userGroups": userGroups
}
};
Attaching a screenshot on the available mbox parameter w.r.t userGroups below,

My requirement is to check whether the user belongs to a certain group and return that group name from the script. With the above highlighted, would I need to check each of these individual params(ranging from 0 to 16) and return for true cases.
Is it possible I can get the userGroup as an array instead(var userGroups = mbox.param('userGroups');) and check whether the user belongs to a particular group(eg:beta1)? Some recommendations on this would be appreciated. Thanks!