简体   繁体   English

使用 let 在 Google 工作表脚本编辑器上声明变量

[英]Declaring variables on Google sheet script editor using let

Whe I try to initialize variable using let I get prompted by this error: Missing ;当我尝试使用let初始化变量时,我收到以下错误提示: Missing ; before statement.声明前。

How to declare variables using let on Google sheet Script editor?如何在 Google 表单脚本编辑器上使用let声明变量?

let was added from ECMAScript 2015 (ES6). let是从 ECMAScript 2015 (ES6) 添加的。 But, unfortunately, Google Apps Script doesn't support ES6 yet.但是,不幸的是,Google Apps Script 还不支持 ES6。 So when let is used in the script editor, in the current stage, the error occurs.所以在脚本编辑器中使用let时候,在当前阶段,就会出现这个错误。

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.很多用户希望将 ES6 添加到 Google Apps Script 中,这是在功能请求上,但是似乎没有取得任何进展。
https://issuetracker.google.com/issues/36764074 https://issuetracker.google.com/issues/36764074

Reference :参考:

If I misunderstand your question, I'm sorry.如果我误解了你的问题,我很抱歉。

Updated at February 12, 2020 2020 年 2 月 12 日更新

Finally, the V8 Runtime has already been added to Google Apps Script.最后,V8 运行时已经添加到 Google Apps 脚本中。 By this, let can be used in Google Apps Script.这样, let就可以在 Google Apps 脚本中使用let

Please check the official document .请查看官方文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM