- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2022 08:42 PM
var a = ["a", "b", "c"];
a.forEach((element) => {
gs.print(element);
});
Why this is not working in background script .
I am getting syntax error
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2022 08:49 PM
Hi,
then syntax => is not supported
use this
var a = ["a", "b", "c"];
a.forEach(function(element){
gs.info(element);
});
Output:
Regards
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
03-28-2022 08:49 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2022 06:08 AM
Just an FYI ServiceNow server side script uses ES5. I don't know which version of Rhino javascript it is but Rhino does not support all of the ES6 standards yet. Client side you get which ever version of javascript the browser supports has.