问题
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