pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Reflect/isExtensible

://developer.mozilla.org/favicon.ico" />

Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

Reflect.isExtensible()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016.

Die statische Methode Reflect.isExtensible() ähnelt Object.isExtensible(). Sie bestimmt, ob ein Objekt erweiterbar ist (ob ihm neue Eigenschaften hinzugefügt werden können).

Probieren Sie es aus

const object1 = {};

console.log(Reflect.isExtensible(object1));
// Expected output: true

Reflect.preventExtensions(object1);

console.log(Reflect.isExtensible(object1));
// Expected output: false

const object2 = Object.seal({});

console.log(Reflect.isExtensible(object2));
// Expected output: false

Syntax

js
Reflect.isExtensible(target)

Parameter

target

Das Zielobjekt, dessen Erweiterbarkeit geprüft werden soll.

Rückgabewert

Ein Boolean, der angibt, ob das Ziel erweiterbar ist oder nicht.

Ausnahmen

TypeError

Wird ausgelöst, wenn target kein Objekt ist.

Beschreibung

Reflect.isExtensible() bietet die reflektierende Semantik zur Überprüfung, ob ein Objekt erweiterbar ist. Der einzige Unterschied zu Object.isExtensible() besteht darin, wie nicht-objekthafte Ziele behandelt werden. Reflect.isExtensible() löst einen TypeError aus, wenn das Ziel kein Objekt ist, während Object.isExtensible() immer false für nicht-objekthafte Ziele zurückgibt.

Reflect.isExtensible() ruft die [[IsExtensible]] interne Objektmethode des target auf.

Beispiele

Verwendung von Reflect.isExtensible()

Siehe auch Object.isExtensible().

js
// New objects are extensible.
const empty = {};
Reflect.isExtensible(empty); // true

// … but that can be changed.
Reflect.preventExtensions(empty);
Reflect.isExtensible(empty); // false

// Sealed objects are by definition non-extensible.
const sealed = Object.seal({});
Reflect.isExtensible(sealed); // false

// Frozen objects are also by definition non-extensible.
const frozen = Object.freeze({});
Reflect.isExtensible(frozen); // false

Unterschied zu Object.isExtensible()

Wenn das target Argument dieser Methode kein Objekt ist (ein primitives), wird dies einen TypeError verursachen. Mit Object.isExtensible() wird ein nicht-objekthaftes target ohne Fehler false zurückgeben.

js
Reflect.isExtensible(1);
// TypeError: 1 is not an object

Object.isExtensible(1);
// false

Spezifikationen

Specification
ECMAScript® 2026 Language Specification
# sec-reflect.isextensible

Browser-Kompatibilität

Siehe auch

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy