How could I get a script to remove this empty string from the array?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2022 04:00 PM
Hello everyone,
How could I get a script to remove this empty string from the array?
[
"test1",
"test2",
"test3",
""
]
[
"test1",
"test2",
"test3"
]
Thanks in advance.
Labels:
- Labels:
-
Scripting and Coding
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2022 05:31 PM
Look up array.filter

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2022 08:18 PM
Hi tested below in background script works fine
var arr = [];
var array = [
"test1",
"test2",
"test3",
""
];
arr = array.filter(function(e){return e});
gs.info(arr);
Regards
Harish
Harish