Error : 'the keyword 'const' is reserved'

KARTIK17
Tera Contributor

Why 'the keyword 'const' is reserved' ? 
if can't use 'const', what can we use instead?

find_real_file.png

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hi,

As of now, ES6 is not support, we're still on ES5, so you'd want to use: var

var sysID = current.getValue('sys_id');

For example. Same with 'let'. You'd want to use the ES5 equivalent.

May want to seek out your peers at Accenture for their styling guide, etc.

There's word that in the next release of ServiceNow, "Tokyo", that ES6 and even higher features will be support, but for now, it's still ES5.

They've said: "We are targeting features from ES6 up to ES12 (ECMAScript 2021). We will have more to announce as the internal engineering is completed and documentation is finalized. Thank you all for your patience over the years and we look forward to getting your feedback once this is released."

https://community.servicenow.com/community?id=community_question&sys_id=0d4083a1db98dbc01dcaf3231f96...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

5 REPLIES 5

Community Alums
Not applicable

Hi Kartik, 

Rather than const, you can use var

Mike

Allen Andreas
Administrator
Administrator

Hi,

As of now, ES6 is not support, we're still on ES5, so you'd want to use: var

var sysID = current.getValue('sys_id');

For example. Same with 'let'. You'd want to use the ES5 equivalent.

May want to seek out your peers at Accenture for their styling guide, etc.

There's word that in the next release of ServiceNow, "Tokyo", that ES6 and even higher features will be support, but for now, it's still ES5.

They've said: "We are targeting features from ES6 up to ES12 (ECMAScript 2021). We will have more to announce as the internal engineering is completed and documentation is finalized. Thank you all for your patience over the years and we look forward to getting your feedback once this is released."

https://community.servicenow.com/community?id=community_question&sys_id=0d4083a1db98dbc01dcaf3231f96...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

In the next release Tokyo, planned for Q4 2022 we'll support ES6

Hello Marc,

and the arrow function? For example this code below funzioniert?

 

Example:

const test = ()=>{alert('Hello')};

test();