- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2019 03:07 AM
Hi All,
I have an array with some values in it.
How to find the minimum value in it?
Suggestions.
Thanks,
Ram
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2019 03:27 AM
Hi Ram,
I assume the values you are having in the array are the integer values or float values
so here is the script; test this in background script and it works in global and custom scope as well and for both integer and float
var array = [20,30];
var min = Math.min.apply(Math, array);
gs.info(min);
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2019 03:27 AM
Hi Ram,
I assume the values you are having in the array are the integer values or float values
so here is the script; test this in background script and it works in global and custom scope as well and for both integer and float
var array = [20,30];
var min = Math.min.apply(Math, array);
gs.info(min);
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
