Google Apps脚本支持哪种版本的ECMA-262? [英] Which Edition of ECMA-262 Does Google Apps Script Support?
问题描述
根据此主题从旧版Google群组,Apps脚本基于ECMA-262第3版。
$编辑器中的自动完成显示第3版数组函数。但是下面的代码运行得很好,这让人对此事产生怀疑:
var array = [
1 ,2,3,4,5
];
Logger.log(forEach:);
array.forEach(function(item,idx,arr){
Logger.log(item);
});
请注意ECMA-262 5th Edition数组函数forEach。
某个权威性的头脑会给出明确的答案,为什么会出现这种情况?是否可以安全地依赖所有的第5版功能或已经实现并似乎可行的子集? 最新文档(2013年6月)表示,Apps脚本提供了一个子集 ECMAScript 5 ,基于 JavaScript 1.8 。
编辑: Google有些回退。截至2013年11月,他们报告说Apps脚本基于1.6,仅有1.7和1.8。
According to this thread from the old Google Group, Apps Script is based on ECMA-262 3rd Edition.
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);
});
Note the use of ECMA-262 5th Edition Array function forEach.
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?
The current documentation (June 2013) says Apps Script provides a subset of ECMAScript 5 and is based on JavaScript 1.8.
Edit: Google has backtracked somewhat. As of Nov 2013, they are reporting that Apps Script is based on 1.6, with a smattering of 1.7 and 1.8.
这篇关于Google Apps脚本支持哪种版本的ECMA-262?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!