简体   繁体   中英

How can I alert supported EcmaScript version of the browser?

有没有办法提醒我运行JavaScript的当前环境支持的EcmaScript版本?

Short answer : No.

Long answer : First of all, browsers doesn't implement ECMAScript but a language based on that specification (eg 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM