The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Which version of JavaScript is supported by ServiceNow?

dev115415
Tera Expert

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.

2 REPLIES 2

Utpal Dutta
Tera Guru

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

Laszlo Balla
ServiceNow Employee
ServiceNow Employee

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.:

LaszloBalla_0-1685897598119.png

Otherwise in the global scope, and any application that is not set to use ES12, it is ES5.