- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 12:44 AM - edited 01-24-2025 12:44 AM
Hello Team,
I am writing below program in Background script to count of Vowels in Given string , I am not able to run this program. not getting any count . Please help me to correct this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 12:54 AM - edited 01-24-2025 12:56 AM
Hello @Community Alums
When you want to print anything in background script use gs.print(); Check below code and run in your background script.
var str = 'servicenow fundamentals';
var vowels = "aeiouAEIOU";
var count = 0;
for (var i = 0; i < str.length; i++) {
if (vowels.includes(str[i])) {
count++;
}
}
// Print the count of vowels
gs.print('Number of vowels: ' + count);
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 12:54 AM - edited 01-24-2025 12:56 AM
Hello @Community Alums
When you want to print anything in background script use gs.print(); Check below code and run in your background script.
var str = 'servicenow fundamentals';
var vowels = "aeiouAEIOU";
var count = 0;
for (var i = 0; i < str.length; i++) {
if (vowels.includes(str[i])) {
count++;
}
}
// Print the count of vowels
gs.print('Number of vowels: ' + count);
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.