Reputation:
Whe I try to initialize variable using let
I get prompted by this error: Missing ; before statement.
How to declare variables using let
on Google sheet Script editor?
Upvotes: 10
Views: 9822
Reputation: 201438
let
was added from ECMAScript 2015 (ES6). But, unfortunately, Google Apps Script doesn't support ES6 yet. So when let
is used in the script editor, in the current stage, the error occurs.
A lot of users want for ES6 to be added to Google Apps Script, It's on the feature requests, however, no progress seems to have been made.
https://issuetracker.google.com/issues/36764074
If I misunderstand your question, I'm sorry.
Finally, the V8 Runtime has already been added to Google Apps Script. By this, let
can be used in Google Apps Script.
Please check the official document.
Upvotes: 14