简体   繁体   English

如何提醒支持的EcmaScript版本的浏览器?

[英]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). 答案很长 :首先,浏览器不实现ECMAScript,而是基于该规范的语言(例如Firefox for JavaScript,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 ). 通常,他们可以实现标准的一部分,并在下一版本的语言中完成标准(例如,在JavaScript 1.8 / 1.8.1 / 1.8.5中关于ES5,请参阅JavaScript中的新功能 )。

Plus, they could anticipate the standard: see for...of or let , that Mozilla has since years, that are part of ES6. 此外,他们可以预见到标准:看看...或者 ,Mozilla多年来,这是ES6的一部分。

So, you can't really say what ES version is supported by your environment; 因此,您无法真正说出您的环境支持的ES版本; 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 . 在大多数情况下,我们在可能的情况下应用垫片来模拟该功能,例如ES5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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