New in JavaScript 1.8

The following is a changelog for JavaScript 1.8. This version was included in Firefox 3 and is part of Gecko 1.9. See bug 380236 for a tracking development bug for JavaScript 1.8.

Using JavaScript 1.8

In order to use some of the new features of JavaScript 1.8 in HTML, use:

<script type="application/javascript;version=1.8">
 ... your code ... 
</script>

Another way (not recommended) to do this is to use the deprecated <script> language attribute and define it as "JavaScript1.8".

When using the JavaScript shell, JavaScript XPCOM components, or XUL <script> elements, the latest JS version (JS1.8 in Mozilla 1.9) is used automatically (bug 381031, bug 385159).

The features that require the use of the new keywords "yield" and "let" require you to specify version 1.7 or higher because existing code might use those keywords as variable or function names. The features that do not introduce new keywords (such as generator expressions) can be used without specifying the JavaScript version.

New features in JavaScript 1.8

Changed functionality in JavaScript 1.8

Changes in destructuring for..in

One change that occurred in the release of JavaScript 1.8 was a bug fix related to the key/value destructuring of arrays introduced in JavaScript 1.7. Previously it was possible to destructure the keys/values of an array by using for ( var [key, value] in array ). However, that made it impossible to destructure the values of an array - that were arrays (i.e., when an iterator returns an array of the current key-value pair). This has been resolved now. (bug 366941). One can, however, use  for ( var [key, value] in Iterator(array)).

Document Tags and Contributors

 Last updated by: fscholz,