| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible | [Back] [Original] |
Get to know MDN better
Esta pgina ha sido traducida del ingls por la comunidad. Aprende ms y nete a la comunidad de MDN Web Docs.
This feature is well established and works across many devices and browser versions. Its been available across browsers since julio de 2015.
El mtodo Object.isExtensible() determina si un objeto es extendible (si puede tener propiedades nuevas agregadas a ste).
Object.isExtensible(obj)
objEl objeto a ser revisado.
Los objetos son extendibles por defecto: ellos pueden tener propiedades nuevas agregadas a ellos, y (en motores que soportan Object.prototype.__proto__ la propiedad __proto__) pueden ser modificados. Un objeto puede ser marcado como no extendible usando Object.preventExtensions(), Object.seal(), o Object.freeze().
// Los Objetos nuevos son extendibles (por defecto).
var empty = {};
Object.isExtensible(empty); // === true
// ...pero eso puede cambiar.
Object.preventExtensions(empty);
Object.isExtensible(empty); // === false
// Objetos sellados por definicin son no-extendibles.
var sealed = Object.seal({});
Object.isExtensible(sealed); // === false
// Objetos congelados tambin por definicin son no-extendibles.
var frozen = Object.freeze({});
Object.isExtensible(frozen); // === false
En ES5, si el argumento pasado a ste mtodo no es un objeto (primitivo), entonces regresar TypeError. En ES6, un no-objeto pasado como argumento ser tratado como si fuera un objeto no-extendible ordinario, simplemente regresa false.
Object.isExtensible(1);
// TypeError: 1 is not an object (ES5 code)
Object.isExtensible(1);
// false (ES6 code)
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-object.isextensible |
Object.preventExtensions()Object.seal()Object.isSealed()Object.freeze()Object.isFrozen()Reflect.isExtensible()This page was last modified on 3 ago 2023 by MDN contributors.
ObjectObject.assign()Object.create()Object.defineProperties()Object.defineProperty()Object.entries()Object.freeze()Object.fromEntries()Object.getOwnPropertyDescriptor()Object.getOwnPropertyDescriptors()Object.getOwnPropertyNames()Object.getOwnPropertySymbols()Object.getPrototypeOf()groupBy()Object.hasOwn()Object.is()Object.isExtensible()Object.isFrozen()Object.isSealed()Object.keys()Object.preventExtensions()Object.seal()Object.setPrototypeOf()Object.values()Object/FunctionYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |