- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2022 06:59 AM
Hello, thanks for reading, I have the following: I have an array and I want it to have a space after the comma (,) example: Signaling, Trailer, Fuel. it´s possible? how can I do it?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2022 07:23 AM
Hi Samuel,
You can easily achieve this via the .join(' ') method as shown below:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var test = fruits.join(', ');
gs.log('array: ' + test);
To help others, please mark correct and/or helpful.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2022 07:03 AM
Hi,
Use .join(', '); //The space is in the speech marks
Thanks
Jake
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2022 07:04 AM
Hello, Here is an example of spaces between array elements. Do chk it for reference: :
var showtimes = ["1pm", "2pm", "3pm"];
var showtimesAsString = showtimes.join(', ');
// gives "1pm, 2pm, 3pm
I hope this helps.
Mark my Answer as Correct and Helpful if ot helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2022 07:23 AM
Hi Samuel,
You can easily achieve this via the .join(' ') method as shown below:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var test = fruits.join(', ');
gs.log('array: ' + test);
To help others, please mark correct and/or helpful.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2022 10:24 AM
thank you! it worked!!!! 🙂