Apps script now supports JavaScript ES6

Apps Script now supports the same modern JavaScript you can use when writing for the browser. Up until now you had to write in a dialect of JavaScript based on ES3, and running on a JavaScript engine emulator. I covered this in some detail in an article some time ago (What JavaScript engine is Apps Script running on?),  but now you can take advantage of JavaScript Es6

Why v8?

The back end has also moved from the JavaScript engine emulator to one based on the V8 engine – the one used in Chrome and NodeJS.

Migrating

Although syntactically there is a lot you can do in ES6 (most of my coding is on Node, so it’s always been painful to go back to do something on Apps Script), pretty much all your old code will run on V8 with no modification (although there are some execution order issues in the global space that have been introduced, which I’ll cover in a later post).

Getting in v8 run mode

There’s a new menu option to enable v8.