Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2019 06:42 AM
Hi All,
I have requirement in scripting part where in
I created array and using "push" method to insert the value.
But I wanted to remove specific value from array and it will be selected dynamically.
Could any one help me out on this.
Solved! Go to Solution.
Labels:
- Labels:
-
Customer Service Management
1 ACCEPTED SOLUTION

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2019 07:04 AM
You might try the splice function to drop a particular value from the array. Check the info about the splice function here.
// Given the following array:
var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
// Iterate through the array and test each value until we find the
// one we're looking for and remove it
for( var i = 0; i < arr.length; i++){
if ( arr[i] === 5) {
arr.splice(i, 1);
}
}
//=> [1, 2, 3, 4, 6, 7, 8, 9, 0] This is the value of arr after the splice
10 REPLIES 10
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2021 10:53 PM
Please remember to mark response helpful.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader