Method 5 : Object.getOwnPropertyDescriptors
The Object.getOwnPropertyDescriptors() method in JavaScript is a standard built-in object which returns all property descriptors of a given object.
Syntax:
Object.getOwnPropertyDescriptors( obj )
Example: In this example, we will see the basic use of the Object.getOwnPropertyDescriptors() method in JavaScript.
Javascript
let geeks1 = { prop1: "w3wiki" } let geeks2 = { prop2: "Best Platform" , prop3: "And Computer science portal" } const descriptor1 = Object.getOwnPropertyDescriptors(geeks1); const descriptor2 = Object.getOwnPropertyDescriptors(geeks2); console.log(descriptor1.prop1.enumerable); console.log(descriptor2.prop2.enumerable); console.log(descriptor1.prop1.value); console.log(descriptor2.prop2.value); console.log(descriptor2.prop3.value); |
true true w3wiki Best Platform And Computer science portal
JS 2017 – ECMAScript 2017
JavaScript (JS) 2017, or ECMAScript 2017, introduced some new features in JavaScript. It enhanced asynchronous programming with async functions, provided shared memory and atomics for improved concurrency, and introduced Object.values() and Object.entries() for streamlined object manipulation. These additions expanded JavaScript’s capabilities, making it more versatile and powerful for modern development.
JavaScript (JS) 2017 new features are:
- String padding
- Object entries() Method
- Object values() Method
- async and await
- Object.getOwnPropertyDescriptors
We will explore all the above methods along with their basic implementation with the help of examples.
Contact Us