Release Notes
https://developers.google.com/apps-script/releases#february_5_2020
V8 syntax examples に記載されているリストによると
- let and const
- Arrow functions
- Classes
- Destructuring assignments
- Template literals
- Default parameters
- Multi-line strings
手順は簡単で
プロジェクトを開くとこのような表示が出る。(アカウントによってはまだ出ない)
「Enable」をクリックするだけ。
戻したい場合
Run メニューから戻すこともできる
Run > Disable new Apps Script runtime powered by Chrome V8
既存のRhino runtimeとV8 runtimeの非互換性によって、移行後に既存のコードが失敗する可能性もあるらしい。(ほぼ大丈夫っぽいけど)
https://developers.google.com/apps-script/guides/v8-runtime/migration
失敗したら修正しよう。
参考
https://developers.google.com/apps-script/releases
February 5, 2020V8 Runtime Overview
Apps Script now supports the V8 runtime. This enables modern JavaScript features and syntax in Apps Script. You can migrate existing scripts to use V8 and its features.
https://developers.google.com/apps-script/guides/v8-runtime
Migrating scripts to the V8 runtime
https://developers.google.com/apps-script/guides/v8-runtime/migration
V8 syntax examples
https://developers.google.com/apps-script/guides/v8-runtime#v8_syntax_examples
Modern JavaScript features
https://developers.google.com/apps-script/guides/services/#modern_javascript_features
The V8 runtime supports modern ECMAScript syntax and features. The Rhino runtime is based on the older JavaScript 1.6 standard, plus a few features from 1.7 and 1.8. You can freely choose which runtime to use with your script, but the V8 runtime is strongly recommended.