- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2023 04:47 AM - edited ‎08-29-2023 04:48 AM
Hi there,
I am trying to use Set() data structure in widget server script but I am getting below error when I am loading the page.
Can you please tell me how can I use Set data structure in server script?
I have heard about Mozilla JS extension (moz) but I don't know how to use that, even if it application in this case.
Please guide me!
Code line:
var reqSet = new Set();
Error:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2023 06:49 AM - edited ‎08-29-2023 06:49 AM
I believe Set() is an ES6 function, so you'd need to make sure you have Javascript mode set to ECMASCript 2021 on the app you're working in. Here's an article with steps on how to do that and then which methods are supported once you turn it on: https://developer.servicenow.com/blog.do?p=/post/tokyo-ecmascript-2021

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2023 06:49 AM - edited ‎08-29-2023 06:49 AM
I believe Set() is an ES6 function, so you'd need to make sure you have Javascript mode set to ECMASCript 2021 on the app you're working in. Here's an article with steps on how to do that and then which methods are supported once you turn it on: https://developer.servicenow.com/blog.do?p=/post/tokyo-ecmascript-2021
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2023 03:41 AM
Thanks for your reply Brad. I am totally satisfied with your answer!