Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 07:45 AM
Hi Dev,
You can use the for loop method to check this values in both the array. Below I have pasted the code snippet.
var consumers = ['example1', 'example2', 'example3'];
var userConsumers = 'example1,example5';//lets say for an example you are getting these values in userConsumer.
var userConsumerSplit = userConsumers.split(',');
var userConsumerArr = [];
userConsumerArr.push(userConsumerSplit[0], userConsumerSplit[1]);
for (var i = 0; i < userConsumerArr.length; i++) {
for (var j = 0; j < consumers.length; j++) {
if (consumers[j] == userConsumerArr[i]) {
gs.info('Consumer found = '+userConsumerArr[i]);//replace with your steps.
} else {
gs.info('No Consumer found')//replace with your steps.
}
}
}
Regards,
Dhanraj.