Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 52781 of New in JavaScript 1.8.5

  • Revision slug: JavaScript/New_in_JavaScript/1.8.5
  • Revision title: New in JavaScript 1.8.5
  • Revision id: 52781
  • Created:
  • Creator: clebermatheus
  • Is current revision? No
  • Comment 13 words added

Revision Content

gecko_minversion_header("2");

JavaScript 1.8.5 is the version of JavaScript included in Firefox 4.

New functions

Function Description
Object.create Creates a new object with the specified prototype object and properties. {{ bug("492840") }}
Object.defineProperty Adds the named property described by a given descriptor to an object.
Object.defineProperties Adds the named properties described by the given descriptors to an object.
Object.getOwnPropertyDescriptor Returns a property descriptor for a named property on an object. {{ bug("505587") }}
Object.keys Returns an array of all enumerable properties on an object. {{ bug("307791") }}
Object.getOwnPropertyNames Returns an array of all enumerable and non-enumerable properties on an object. {{ bug("518663") }}
Object.preventExtensions Prevents any extensions of an object. {{ bug("492849") }}
Object.isExtensible Determine if extending of an object is allowed. {{ bug("492849") }}
Object.seal Prevents other code from deleting properties of an object. {{ bug("492845") }}
Object.isSealed Determine if an object is sealed. {{ bug("492845") }}
Object.freeze Freezes an object: other code can't delete or change any properties. {{ bug("492844") }}
Object.isFrozen Determine if an object was frozen. {{ bug("492844") }}
Array.isArray Checks if a variable is an array. {{ bug("510537") }}
Date.toJSON Returns a JSON format string for a Date object.
Function.prototype.bind Creates a new function that, when called, itself calls this function in the context provided (with a given sequence of arguments) {{ bug("429507") }}

New ECMAScript5 features

  • get and set operators now allows the identifier to be numeric or a string. {{ bug("520696") }}
  • Function.apply() can accept any array-like object as the arguments list, instead of only true arrays.
  • strict mode support
  • Array.toString() now works even on non-arrays by either returning the result of calling its join() method if one is available or by calling its toString() method.

Other standardization work

Various non-standard syntaxes for defining getters and setters have been removed; ECMAScript 5 defined syntax has not been changed. These were all pretty esoteric and rarely used; if this affects you, see this blog post for details.

New objects

Object Description
Proxy Offers support for creating Object and Function proxies that enable meta-programming in JavaScript.

Changes to global objects

ISO 8601 support in Date
The Date object's parse() method now supports simple ISO 8601 format date strings.
Global objects made read only
The NaN, Infinity, and undefined global objects have been made read only, per the ECMAScript 5 specification.

Additional changes

JavaScript (SpiderMonkey) API changes

Note: Locale callbacks (as specified in the JSLocaleCallbacks structure) should not free the memory buffer passed to them; this buffer is managed by the SpiderMonkey runtime.

The JS_NewString() function was removed in SpiderMonkey 1.8.5. Use JS_NewStringCopyN() instead.

{{ languages( { "es":"es/JavaScript/Novedades_en_JavaScript/Novedades_en_JavaScript_1.8.5", "ja":"ja/JavaScript/New_in_JavaScript/1.8.5", "pt":"pt/JavaScript/Novo no JavaScript/1.8.5" } ) }}

Revision Source

<pre class="script" style="font-size: 16px;">gecko_minversion_header("2");
</pre>
<p>JavaScript 1.8.5 is the version of JavaScript included in Firefox 4.</p>
<h2 id="New_functions">New functions</h2>
<table class="standard-table"> <thead> <tr> <th scope="col">Function</th> <th scope="col">Description</th> </tr> </thead> <tbody> <tr> <td><code><a class="internal" href="/en/JavaScript/Reference/Global_Objects/Object/create" title="En/Core JavaScript 1.5
            Reference/Global Objects/Object/Create">Object.create</a></code></td> <td>Creates a new object with the specified prototype object and properties. {{ bug("492840") }}</td> </tr> <tr> <td><code><a class="internal" href="/en/JavaScript/Reference/Global_Objects/Object/defineProperty" title="En/Core JavaScript 1.5 Reference/Global
            Objects/Object/DefineProperty">Object.defineProperty</a></code></td> <td>Adds the named property described by a given descriptor to an object.</td> </tr> <tr> <td><code><a class="internal" href="/en/JavaScript/Reference/Global_Objects/Object/defineProperties" title="En/Core JavaScript 1.5 Reference/Global
            Objects/Object/DefineProperties">Object.defineProperties</a></code></td> <td>Adds the named properties described by the given descriptors to an object.</td> </tr> <tr> <td><code><a class="internal" href="/en/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor" title="En/Core JavaScript 1.5 Reference/Global
            Objects/Object/GetOwnPropertyDescriptor">Object.getOwnPropertyDescriptor</a></code></td> <td>Returns a property descriptor for a named property on an object. {{ bug("505587") }}</td> </tr> <tr> <td><a href="/en/JavaScript/Reference/Global_Objects/Object/keys" title="en/Core JavaScript
            1.5 Reference/Global Objects/Object/keys"><code>Object.keys</code></a></td> <td>Returns an array of all enumerable properties on an object. {{ bug("307791") }}</td> </tr> <tr> <td><a href="/en/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames" title="en/Core
            JavaScript 1.5 Reference/Global Objects/Object/getOwnPropertyNames"><code>Object.getOwnPropertyNames </code></a></td> <td>Returns an array of all enumerable and non-enumerable properties on an object. {{ bug("518663") }}</td> </tr> <tr> <td><a href="/en/JavaScript/Reference/Global_Objects/Object/preventExtensions" title="en/Core
            JavaScript 1.5 Reference/Global Objects/Object/preventExtensions"><code>Object.preventExtensions</code></a></td> <td>Prevents any extensions of an object. {{ bug("492849") }}</td> </tr> <tr> <td><a href="/en/JavaScript/Reference/Global_Objects/Object/isExtensible" title="en/Core
            JavaScript 1.5 Reference/Global Objects/Object/isExtensible"><code>Object.isExtensible</code></a></td> <td>Determine if extending of an object is allowed. {{ bug("492849") }}</td> </tr> <tr> <td><a href="/en/JavaScript/Reference/Global_Objects/Object/seal" title="en/Core
            JavaScript 1.5 Reference/Global Objects/Object/seal"><code>Object.seal</code></a></td> <td>Prevents other code from deleting properties of an object. {{ bug("492845") }}</td> </tr> <tr> <td><a href="/en/JavaScript/Reference/Global_Objects/Object/isSealed" title="en/Core
            JavaScript 1.5 Reference/Global Objects/Object/isSealed"><code>Object.isSealed</code></a></td> <td>Determine if an object is sealed. {{ bug("492845") }}</td> </tr> <tr> <td><a href="/en/JavaScript/Reference/Global_Objects/Object/freeze" title="en/Core
            JavaScript 1.5 Reference/Global Objects/Object/freezed"><code>Object.freeze</code></a></td> <td>Freezes an object: other code can't delete or change any properties. {{ bug("492844") }}</td> </tr> <tr> <td><a href="/en/JavaScript/Reference/Global_Objects/Object/isFrozen" title="en/Core
            JavaScript 1.5 Reference/Global Objects/Object/isFrozen"><code>Object.isFrozen</code></a></td> <td>Determine if an object was frozen. {{ bug("492844") }}</td> </tr> <tr> <td><a href="/en/JavaScript/Reference/Global_Objects/Array/isArray" title="en/Core JavaScript
            1.5 Reference/Global Objects/Array/isArray"><code>Array.isArray </code></a></td> <td>Checks if a variable is an array. {{ bug("510537") }}</td> </tr> <tr> <td><a href="/en/JavaScript/Reference/Global_Objects/Date/toJSON" title="en/JavaScript/Reference/Global Objects/Date/toJSON"><code>Date.toJSON</code></a></td> <td>Returns a JSON format string for a <code>Date</code> object.</td> </tr> <tr> <td><a href="/en/JavaScript/Reference/Global_Objects/Function/bind" title="en/JavaScript/Reference/Global_Objects/Function/bind"><code>Function.prototype.bind</code></a></td> <td>Creates a new function that, when called, itself calls this function in the context provided (with a given sequence of arguments) {{ bug("429507") }}</td> </tr> </tbody>
</table>
<h2 id="New_ECMAScript5_features">New ECMAScript5 features</h2>
<ul> <li><code><a href="/en/JavaScript/Reference/Operators/get" title="en/JavaScript/Reference/Operators/Special Operators/get Operator">get</a></code> and <code><a href="/en/JavaScript/Reference/Operators/set" title="en/JavaScript/Reference/Operators/Special Operators/set Operator">set</a></code> operators now allows the identifier to be numeric or a string. {{ bug("520696") }}</li> <li><a href="/en/JavaScript/Reference/Global_Objects/Function/apply" title="en/JavaScript/Reference/Global Objects/Function/apply"><code>Function.apply()</code></a> can accept any array-like object as the arguments list, instead of only true arrays.</li> <li><a href="/en/JavaScript/Reference/Functions_and_function_scope/Strict_mode" title="en/JavaScript/Strict mode">strict mode support</a></li> <li><a href="/en/JavaScript/Reference/Global_Objects/Array/toString" title="en/JavaScript/Reference/Global Objects/Array/toString"><code>Array.toString()</code></a> now works even on non-arrays by either returning the result of calling its <a href="/en/JavaScript/Reference/Global_Objects/Array/join" title="en/JavaScript/Reference/Global Objects/Array/join"><code>join()</code></a> method if one is available or by calling its <a href="/en/JavaScript/Reference/Global_Objects/Object/toString" title="en/JavaScript/Reference/Global Objects/Object/toString"><code>toString()</code></a> method.</li>
</ul>
<h2 id="Other_standardization_work">Other standardization work</h2>
<p>Various non-standard syntaxes for defining getters and setters have been removed; ECMAScript 5 defined syntax has not been changed. These were all pretty esoteric and rarely used; if this affects you, see <a class="external" href="https://whereswalden.com/2010/04/16/more-spidermonkey-changes-ancient-esoteric-very-rarely-used-syntax-for-creating-getters-and-setters-is-being-removed/" title="https://whereswalden.com/2010/04/16/more-spidermonkey-changes-ancient-esoteric-very-rarely-used-syntax-for-creating-getters-and-setters-is-being-removed/">this blog post</a> for details.</p>
<h2 id="New_objects">New objects</h2>
<table class="standard-table"> <thead> <tr> <th scope="col">Object</th> <th scope="col">Description</th> </tr> </thead> <tbody> <tr> <td><code><a href="/en/JavaScript/Reference/Global_Objects/Proxy" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Proxy">Proxy</a></code></td> <td>Offers support for creating <code>Object</code> and <code>Function</code> proxies that enable meta-programming in JavaScript.</td> </tr> </tbody>
</table>
<h2 id="Changes_to_global_objects">Changes to global objects</h2>
<dl> <dt>ISO 8601 support in <code>Date</code></dt> <dd>The <a href="/en/JavaScript/Reference/Global_Objects/Date" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date"><code>Date</code></a> object's <a href="/en/JavaScript/Reference/Global_Objects/Date/parse" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/parse"><code>parse()</code></a> method now supports simple ISO 8601 format date strings.</dd> <dt>Global objects made read only</dt> <dd>The <a href="/en/JavaScript/Reference/Global_Objects/NaN" title="en/JavaScript/Reference/Global Objects/NaN"><code>NaN</code></a>, <a href="/en/JavaScript/Reference/Global_Objects/Infinity" title="en/JavaScript/Reference/Global Objects/Infinity"><code>Infinity</code></a>, and <a href="/en/JavaScript/Reference/Global_Objects/undefined" title="en/JavaScript/Reference/Global Objects/undefined"><code>undefined</code></a> global objects have been made read only, per the ECMAScript 5 specification.</dd>
</dl>
<h2 id="Additional_changes">Additional changes</h2>
<ul> <li><a href="/en/JavaScript/Reference/Global_Objects/Object/Parent" title="en/JavaScript/Reference/Global Objects/Object/Parent"><code>obj.__parent__</code></a> and <code>obj.__count__</code> become obsolete. Some information about why: <a class="external" href="https://whereswalden.com/2010/05/07/spidermonkey-change-du-jour-the-special-__parent__-property-has-been-removed/" title="https://whereswalden.com/2010/05/07/spidermonkey-change-du-jour-the-special-__parent__-property-has-been-removed/">SpiderMonkey change du jour: the special __parent__ property has been removed</a> {{ bug("551529") }} &amp; {{ bug("552560") }}.</li> <li>Trailing commas no longer accepted in <a href="/En/Using_native_JSON" title="En/Using native JSON"><code>JSON.parse()</code></a>.</li>
</ul>
<h2 id="JavaScript_(SpiderMonkey)_API changes">JavaScript (SpiderMonkey) API changes</h2>
<div class="note"><strong>Note:</strong> Locale callbacks (as specified in the <a href="/en/JSLocaleCallbacks" title="en/JSLocaleCallbacks">JSLocaleCallbacks</a> structure) should not free the memory buffer passed to them; this buffer is managed by the SpiderMonkey runtime.</div>
<p>The <a href="/en/SpiderMonkey/JSAPI_Reference/JS_NewString" title="en/SpiderMonkey/JSAPI Reference/JS NewString"><code>JS_NewString()</code></a> function was removed in SpiderMonkey 1.8.5. Use <a href="/en/SpiderMonkey/JSAPI_Reference/JS_NewStringCopyN" title="en/SpiderMonkey/JSAPI Reference/JS NewStringCopyN"><code>JS_NewStringCopyN()</code></a> instead.</p>
<p>{{ languages( { "es":"es/JavaScript/Novedades_en_JavaScript/Novedades_en_JavaScript_1.8.5", "ja":"ja/JavaScript/New_in_JavaScript/1.8.5", "pt":"pt/JavaScript/Novo no JavaScript/1.8.5" } ) }}</p>
Revert to this revision