maybe this should go into "random" channel, but do...
# suitescript
d
maybe this should go into "random" channel, but does anyone happen to know why you can use
const
in SuiteScript but not
let
? also it seems like the JS engine just transforms all const to simple
var
anyway since reassignment does not throw an error
from my understanding NetSuite uses Rhino engine which is running JS version 5.1, but const is not in this ECMA spec, so curious how using const itself does not throw an error
b
Suitescript has a non compliant const
Doesnt throw errors upon reassignment attempts and is not block scoped
☝️ 1
d
would it be reasonable to say there is no risk in using const? (for benefit to get linting intellisense errors during dev etc.)
b
i personally wouldn't touch it
but its probably okay if you use it as if it were compliant
if you do something wrong, you may have something to fix when 2.1 comes around
d
agreed. thanks for the clarification 👍
s
actually you're not ok because of block scope
so you can't use it as if it were standard compliant?
b
meh, im in the avoid camp
s
ditto
m
you could write in ES6 then use babel to compile. It doesn't take any extra time if you're using VSCode
s
or better yet, TypeScript.