ES6 and ServiceNow (const, let and var)
Options
- 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:
- Labels:
-
Best Practices
- 8,396 Views
5 REPLIES 5
Options
- 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?