Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following JavaScript code?
const obj1 =
{
property1: 21
}
const descriptor1 = Object.getOwnPropertyDescriptor(obj1, ‘property1’);
console.log(descriptor1.configurable);
console.log(descriptor1.enumerable);

What will be the output of the following JavaScript code?
const obj1 =
{
property1: 21
}
const descriptor1 = Object.getOwnPropertyDescriptor(obj1, ‘property1’);
console.log(descriptor1.configurable);
console.log(descriptor1.enumerable);
a) true 21
b) true false
c) true true
d) false false

Answer: c
Explanation: The Object.getOwnPropertyDescriptor method allows to query the full information about a property. The method returns a property descriptor for an own property that is one directly present on an object and not in the object’s prototype of a given object.

Join The Discussion