Which Edition of ECMA-262 Does Google Apps Script Support?

不羁的心 提交于 2019-11-26 06:39:22

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/17252409/which-edition-of-ecma-262-does-google-apps-script-support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!