🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)
🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)

🔧 Programmierung 🕛 kürzlich 4 Min Lesezeit
0

JavaScript Object Methods Example

↗ Quelle (dev.to)
🗣️ Stimme:




JavaScript Object Methods Example.





  • Object.keys(obj): Returns an array of an object's own enumerable property names (keys).




CODE
const obj = { a: 1, b: 2, c: 3 };
console.log(Object.keys(obj));
// Output: ['a', 'b', 'c']








  • Object.values(obj): Returns an array of the object's own enumerable property values.




CODE
const obj = { a: 1, b: 2, c: 3 };
console.log(Object.values(obj));
// Output: [1, 2, 3]








  • Object.entries(obj): Returns an array of the object's own enumerable string-keyed property [key, value] pairs.




CODE
const obj = { a: 1, b: 2, c: 3 };
console.log(Object.entries(obj));
// Output: [['a', 1], ['b', 2], ['c', 3]]








  • Object.isSealed(obj): Returns true if the object is sealed, otherwise false.




CODE
const obj = Object.seal({ a: 1 });
console.log(Object.isSealed(obj));
// Output: true








  • Object.assign(target, source): Copies the values of all enumerable properties from one or more source objects to a target object. It returns the target object.




CODE
const target = { a: 1 };
const source = { b: 2, c: 3 };
const result = Object.assign(target, source);
console.log(result);
// Output: { a: 1, b: 2, c: 3 }








  • Object.freeze(obj): Freezes an object, preventing new properties from being added or existing properties from being removed or reconfigured.




CODE
const obj = { name: 'Khabib' };
Object.freeze(obj);
obj.name = 'Bob'; // This won't change the value
console.log(obj.name); // Output: 'Khabib'








  • Object.seal(obj): Seals an object, preventing new properties from being added, but allowing existing properties to be modified.




CODE
const obj = { name: 'Alice' };
Object.seal(obj);
obj.name = 'Bob'; // This will update the value
obj.age = 25; // This won't add a new property
console.log(obj); // Output: { name: 'Bob' }








  • Object.create(proto): Creates a new object with the specified prototype object and properties.




CODE
const person = {greet() {console.log('Hello!');}};
const student = Object.create(person);
student.greet();
// Output: 'Hello!'








  • Object.defineProperty(obj, prop, descriptor): Defines a new property directly on an object or modifies an existing property.




CODE
const obj = {};
Object.defineProperty(obj, 'name', {
value: 'Alice',
writable: false });
console.log(obj.name); // 'Alice'








  • Object.defineProperties(obj, props): Defines multiple new properties or modifies existing properties on an object.




CODE
const obj = {};
Object.defineProperties(obj, {
name: { value: 'Cormier', writable: false },
age: { value: 30, writable: true } });
console.log(obj.name); // 'Cormier'








  • Object.isExtensible(obj): Determines if an object is extensible (i.e., whether new properties can be added).




CODE
const obj = {};
console.log(Object.isExtensible(obj)); // true
Object.preventExtensions(obj);
console.log(Object.isExtensible(obj)); // false








  • Object.isFrozen(obj): Determines if an object is frozen (i.e., not extensible and all properties are non-writable).




CODE
const obj = Object.freeze({ name: 'Gregor' });
console.log(Object.isFrozen(obj));
// output: true








  • Object.hasOwn(obj, prop): Returns true if the specified object has the specified property as its own property, even if the property's value is undefined.




CODE
const obj = { name: 'Alice' };
console.log(Object.hasOwn(obj, 'name')); // true
console.log(Object.hasOwn(obj, 'age')); // false








  • Object.hasOwnProperty(prop): Determines if an object contains the specified property as a direct property of that object and not inherited through the prototype chain.




CODE
const obj = { name: 'Alice' };
console.log(obj.hasOwnProperty('name')); // true
console.log(obj.hasOwnProperty('age')); // false








  • Object.preventExtensions(obj): Prevents new properties from ever being added to an object.




CODE
const obj = {};
Object.preventExtensions(obj);
obj.name = 'Khabib'; // Won't be added
console.log(obj); // {}








  • Object.setPrototypeOf(obj, proto): Sets the prototype (the internal [[Prototype]] property) of a specified object.




CODE
const proto = { greet() {console.log('Hello!');}};
const obj = {};
Object.setPrototypeOf(obj, proto);
obj.greet(); // 'Hello!'








  • Object.fromEntries(iterable): Transforms a list of key-value pairs into an object.




CODE
const entries = [['name', 'Rock'], ['age', 35]];
const obj = Object.fromEntries(entries);
console.log(obj); // { name: 'Rock', age: 35 }








  • Object.getPrototypeOf(obj): Returns the prototype (the internal [[Prototype]] property) of the specified object.




CODE
const obj = {};
const proto = Object.getPrototypeOf(obj);
console.log(proto === Object.prototype); // true








  • Object.getOwnPropertySymbols(obj): Returns an array of all symbol properties found on the object.




CODE
const symbol = Symbol('id');
const obj = { [symbol]: 123 };
const symbols = Object.getOwnPropertySymbols(obj);
console.log(symbols); // [Symbol(id)]
console.log(obj[symbols[0]]); // 123








  • Object.getOwnPropertyDescriptor(obj, prop): Returns a property descriptor for a specific property of a given object.




CODE
const obj = { name: 'Alice', age: 26 };
const descriptor = Object.getOwnPropertyDescriptor(obj, 'name');
console.log(descriptor);
// Output: { configurable: true, enumerable: true, value: "Alice", writable: true }








  • Object.getOwnPropertyNames(obj): Returns an array of all properties found on the object (including non-enumerable properties).




CODE
const obj = { name: 'Ferguson', age: 30 };
const propertyNames = Object.getOwnPropertyNames(obj);
console.log(propertyNames); // ['name', 'age']








  • Object.is(value1, value2): Compares if two values are the same.




CODE
console.log(Object.is('foo', 'foo')); // true
console.log(Object.is({}, {})); // false








  • Object.getOwnPropertyDescriptors(obj): Returns all own property descriptors of an object.




CODE
const obj = { name: 'Khabib', age: 28 };
const descriptors = Object.getOwnPropertyDescriptors(obj);
console.log(descriptors);
// Output: {
age: {
configurable: true,
enumerable: true,
value: 28,
writable: true },
name: {
configurable: true,
enumerable: true,
value: "Khabib",
writable: true
}
}


Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
3 Quellen
GPT-6 Astra Release Today? OpenAI’s Next Major AI Model Is Almost Here
1 Quelle
Apple accuses OpenAI of destroying evidence as trade-secrets fight intensifies
1 Quelle
Major AI platforms go down in unprecedented simultaneous outage
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten JavaScript Object Methods Example

Thematisch verwandte Begriffe: JavaScript, Object, Methods, Example · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...