我如何知道我使用的是哪个版本的 Javascript?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4271566/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I know which version of Javascript I'm using?
提问by Exitos
I'm just reading this documentation about Javascript 1.2, but I'm wondering which version of Javascript is being used in the most popular browsers.
我只是在阅读有关 Javascript 1.2 的文档,但我想知道最流行的浏览器正在使用哪个版本的 Javascript。
http://www.tutorialspoint.com/javascript/javascript_nested_functions.htm
http://www.tutorialspoint.com/javascript/javascript_nested_functions.htm
采纳答案by Nick Craver
Wikipedia (or rather, the community onWikipedia) keeps a pretty good up-to-date list here.
维基百科(或者更确切地说,维基百科上的社区)在这里保存了一个非常好的最新列表。
- Most browsers are on 1.5 (though they have features of later versions)
- Mozilla progresses with every dot release (they maintain the standard so that's not surprising)
- Firefox 4 is on JavaScript 1.8.5
- The other big off-the-beaten-path one is IE9 - it implements ECMAScript 5, but doesn't implement all the features of JavaScript 1.8.5 (not sure what they're calling this version of JScript, engine codenamed Chakra, yet).
- 大多数浏览器都在 1.5 上(尽管它们具有更高版本的功能)
- Mozilla 随着每个 dot 版本的发布而进步(他们保持标准,所以这并不奇怪)
- Firefox 4 基于 JavaScript 1.8.5
- 另一个大的不受欢迎的路径是 IE9 - 它实现了 ECMAScript 5,但没有实现 JavaScript 1.8.5 的所有功能(不确定他们称之为这个版本的 JScript,引擎代号为Chakra,但)。
回答by Alex Wayne
Click on this link to see which version your BROWSER is using: http://jsfiddle.net/Ac6CT/
单击此链接以查看您的浏览器使用的是哪个版本:http: //jsfiddle.net/Ac6CT/
You should be able filter by using script tags to each JS version.
您应该能够通过对每个 JS 版本使用脚本标签进行过滤。
<script type="text/javascript">
var jsver = 1.0;
</script>
<script language="Javascript1.1">
jsver = 1.1;
</script>
<script language="Javascript1.2">
jsver = 1.2;
</script>
<script language="Javascript1.3">
jsver = 1.3;
</script>
<script language="Javascript1.4">
jsver = 1.4;
</script>
<script language="Javascript1.5">
jsver = 1.5;
</script>
<script language="Javascript1.6">
jsver = 1.6;
</script>
<script language="Javascript1.7">
jsver = 1.7;
</script>
<script language="Javascript1.8">
jsver = 1.8;
</script>
<script language="Javascript1.9">
jsver = 1.9;
</script>
<script type="text/javascript">
alert(jsver);
</script>
My Chrome reports 1.7
我的 Chrome 报告 1.7
Blatantly stolen from: http://javascript.about.com/library/bljver.htm
回答by Salvador Dali
In chrome you can find easily not only your JS version but also a flash version. All you need is to type chrome://version/
in a command line and you will get something like this:
在 chrome 中,您不仅可以轻松找到 JS 版本,还可以轻松找到 Flash 版本。你所需要的只是输入chrome://version/
一个命令行,你会得到这样的东西:
回答by Robin Maben
Rather than finding which version you are using you can rephrase your question to "which version of ECMA script does my browser's JavaScript/JSscript engine conform to".
您可以将您的问题改写为“我的浏览器的 JavaScript/JSscript 引擎符合哪个版本的 ECMA 脚本”,而不是查找您正在使用的版本。
For IE :
对于 IE :
alert(@_jscript_version); //IE
Refer Squeegy's answer for non-IE versions :)
对于非 IE 版本,请参阅 Squeegy 的答案:)
回答by Ivo Wetzel
All of todays browsers use at least version 1.5
:
http://en.wikipedia.org/wiki/ECMAScript#Dialect
今天所有的浏览器都至少使用版本1.5
:http:
//en.wikipedia.org/wiki/ECMAScript#Dialect
Concerning your tutorial site, the information there seems to be extremely outdated, I begyou to head over to MDC and read their Guide:
https://developer.mozilla.org/en/JavaScript/Guide
关于您的教程站点,那里的信息似乎非常过时,我恳求您前往 MDC 并阅读他们的指南:https:
//developer.mozilla.org/en/JavaScript/Guide
You may still want to watch out for features which require version 1.6
or above, as this might give Internet Explorer some troubles.
您可能仍要注意需要版本1.6
或更高版本的功能,因为这可能会给 Internet Explorer 带来一些麻烦。
回答by NickFitz
JavaScript 1.2 was introduced with Netscape Navigator 4 in 1997. That version number only ever had significance for Netscape browsers. For example, Microsoft's implementation (as used in Internet Explorer) is called JScript, and has its own version numbering which bears no relation to Netscape's numbering.
JavaScript 1.2 于 1997 年随 Netscape Navigator 4 一起推出。该版本号只对 Netscape 浏览器有意义。例如,Microsoft 的实现(在 Internet Explorer 中使用)称为 JScript,它有自己的版本编号,与 Netscape 的编号无关。