Google Apps Script 支持哪个版本的 ECMA-262? [英] Which Edition of ECMA-262 Does Google Apps Script Support?

查看:28
本文介绍了Google Apps Script 支持哪个版本的 ECMA-262?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据这个帖子来自旧的 Google Group,Apps Script 基于 ECMA-262 第 3 版.

According to this thread from the old Google Group, Apps Script is based on ECMA-262 3rd Edition.

编辑器中的自动完成功能显示第 3 版数组函数这一事实似乎支持了这一点.

This would seem to be supported by the fact that auto-completion in the editor displays 3rd Edition array functions.

但是下面的代码运行得很好,这让人怀疑:

However the following code runs perfectly well, which casts doubt on the matter:

var array = [
  1,2,3,4,5
];

Logger.log("forEach:");
array.forEach(function (item,idx,arr) {
  Logger.log(item); 
});

注意 ECMA-262 第 5 版数组函数 forEach 的使用.

Note the use of ECMA-262 5th Edition Array function forEach.

是否会有权威人士给出明确的答案,说明为什么会这样?依赖第 5 版的所有功能或已实施且似乎有效的子集是否安全?

Would someone authoritative mind giving a definitive answer on why this is the case? And whether it's safe to rely on all 5th Edition features or a sub-set that have been implemented and seem to work?

推荐答案

documentation 说旧的运行时基于 Mozilla 的 Rhino JavaScript 解释器,它提供了 ECMAScript 的子集5 并基于 1.6,略有 1.7 和 1.8.

The documentation says that the old runtime is based on Mozilla's Rhino JavaScript interpreter which provides a subset of ECMAScript 5 and is based on 1.6, with a smattering of 1.7 and 1.8.

V8 运行时支持新的 Apps 脚本运行时除了 E6 模块等少数例外.

The new Apps Script runtime is supported by the V8 runtime with few exceptions like E6 Modules.

这篇关于Google Apps Script 支持哪个版本的 ECMA-262?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆