Which version of JavaScript is supported by ServiceNow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2023 09:23 AM
Hello
Which version of JavaScript is supported by ServiceNow?
I could not use arrow(=>) notation in Script Include. Also in UI Pages I have to close each html tag like <br/>. But it was in quite earlier versions of Html. Now we can simply write <br> but this gives error in ServiceNow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2023 09:52 AM
Hi Dev,
ServiceNow Supports JavaScript ECMA 6 which is also called Vanilla JavaScript. The arrow notation you're talking about (=>) is actually supported by JavaScript ECMA Script 2021 in ServiceNow which is introduced in Tokyo release. This is only supported in Scoped Application & not in Global.
ServiceNow still understands Vanilla Script but there is a translator in between which translate all the new JavaScript into the older one and then it executes.
If you need more information please visit this blog post.
If my answer was helpful then please mark it Helpful or Correct.
Thanks,
Utpal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2023 09:54 AM
You can use ECMAScript2021 but only in custom application scopes, which might need to be enabled specifically (it is default from the Utah version though).
You can check this is you open the application record (sys_app), e.g.:
Otherwise in the global scope, and any application that is not set to use ES12, it is ES5.