Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Chrome - JavaScript version

Which version of JavaScript does Google Chrome support in relation to Mozilla Firefox? In other words, does Chrome support JavaScript 1.6, 1.7, or 1.8 which Firefox also supports or some combination of them?

like image 697
brad Avatar asked Nov 18 '08 21:11

brad


People also ask

What is current version of JavaScript?

ES2015 is the latest version of JavaScript programming language.

Does Chrome use ES6?

Safari, Chrome, Firefox and Edge all support the ES6 Modules import syntax.

How can I check JavaScript version?

Visit the System information tool to see what version of JavaScript is detected. JavaScript is browser dependent, which means the version of JavaScript detected may be different in Firefox than the version detected by Internet Explorer.


1 Answers

While Chrome will execute Javascript marked as "javascript1.7", it does not support JS1.7 features like the "let" scoped variable operator.

This code will run on Firefox 3.5 but not on Chrome using V8:

<script language="javascript" type="application/javascript;version=1.7">     function foo(){ let a = 4; alert(a); }; foo(); </script> 

If you change language to "javascript1.7" and omit the type, it won't run with JS 1.7 features in Firefox 3.5. The type section is necessary.

This seems to be related to a general WebKit bug, https://bugs.webkit.org/show_bug.cgi?id=23097; it may be that Chrome emulates the Safari behavior even though it uses a different engine.

When asked about supporting JS 1.8 features, the V8 team said they were trying to track the version used in Safari so pages would act the same in both browsers.

like image 89
Ben Combee Avatar answered Sep 21 '22 10:09

Ben Combee