user8612252
user8612252

Reputation:

Declaring variables on Google sheet script editor using let

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

Answers (1)

Tanaike
Tanaike

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

Reference :

If I misunderstand your question, I'm sorry.

Updated at February 12, 2020

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

Related Questions