ES6 and ServiceNow (const, let and var)
This content was last updated in 2024. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2019 06:43 PM
Why does 'const' get processed but 'let' does not?
Both are supported in ES6 and not in ES5. The following are run in a background script.
For example:
const object1 = {
a: 'somestring',
b: 42,
c: false
};
Prints:
*** Script: a,b,c
Yet,
let object1 = {
a: 'somestring',
b: 42,
c: false
};
Prints:
Javascript compiler exception: let is an ECMAScript 6 feature - not supported (null.null.script; line 1) in:
let object1 = {
a: 'somestring',
b: 42,
c: false
};
The assumption here is that 'const' would not get processed by the JS engine as it's a part of ES6 functionality which is not supported by ServiceNow.
Thoughts?
- Labels:
-
Best Practices
- 11,052 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2024 09:51 AM
This is ridiculous. The last year I've had to develop in the Global scope and I have to ignore our existing coding standards. Is there any talks on upgrading the base of SN to ES6 at the very least?