How can I alert supported EcmaScript version of the browser?

别等时光非礼了梦想. 提交于 2019-12-08 08:16:52

问题


Is there a way to alert the supported EcmaScript version of the current environment where I run my JavaScript?


回答1:


Short answer: No.

Long answer: First of all, browsers doesn't implement ECMAScript but a language based on that specification (e.g. JavaScript for Firefox, JScript for Microsoft). Often, they can implement part of the standard, and complete the standard in a next version of the language (it happened in JavaScript 1.8 / 1.8.1 / 1.8.5 about ES5 for example, see New in JavaScript).

Plus, they could anticipate the standard: see for...of or let, that Mozilla has since years, that are part of ES6.

So, you can't really say what ES version is supported by your environment; what you can do is testing the functionality you are interested in, and use them. In most of the case, we apply a shim, where is possible, to emulate that functionality, like for ES5.



来源:https://stackoverflow.com/questions/14747171/how-can-i-alert-supported-ecmascript-version-of-the-browser

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