- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 06:59 AM
Hi All,
I need to add double quotes to values in an array please help me on how to do that.
Example: var arr=["servicenow,community"];
I have an array like this but i need the array as var arr=["servicenow","community"]; via server script
Please tell me on how to solve this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 07:42 AM
It looks like you have a value as a string but need to have multiple values instead.
You could try to split this string into multiple values before putting it in the array.
try this one
var someValue = "servicenow,community";
arr = someValue.split(',');
gs.print(arr);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 07:01 AM
Hi,
Please do as below
arr=['"servicenow"','"community"'];
gs.print(arr)
If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.
Regards,
Saurabh
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 07:03 AM
var arr=["servicenow,community"]; i have an array like this i need to change it to var arr=["servicenow","community"];
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 07:05 AM
Add single ' also before " and after ". Like below
'"servicenow"','"community"'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 07:28 AM
I need via script