This is an archived page. It's not actively maintained.

New in JavaScript 1.8.5

以下為 JavaScript 1.8.5 的更新日誌,此版本被涵蓋於 Firefox 4 之中。

JavaScript 1.8.5 新功能


函數 敘述

基於一個特定的原型物件和屬性,建立一個新物件。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

避免其他程式碼刪除一個物件的屬性。 bug 492845

Object.isSealed() Determine if an object is sealed. bug 492845
Object.freeze() 凍結一個物件:其他程式碼無法刪除或更便任何屬性。bug 492844
Object.isFrozen() 辨識一個物件是否遭凍結。bug 492844
Array.isArray() 檢查一個變數是否為陣列。bug 510537
Date.prototype.toJSON() 回傳一個 JSON 格式的字串 給Date 物件。

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

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.


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

Changed functionality in JavaScript 1.8.5