in JavaScript by
Which one of the following is the correct output for the given JavaScript code?

const obj ={prop:12};  

Object.preventExtensions(obj);  

console.log(Object.isExtensible(obj));  

a) 12

b) error

c) true

d) false

1 Answer

0 votes
by

Answer: D

Reason: Object.preventExtensions () only prevents adding new properties that have ever been added to an object. This change is not reversible, meaning that once an object becomes non-extensible, it cannot be changed to an extensible.

Related questions

0 votes
asked Mar 22, 2021 in JavaScript by Robindeniel
0 votes
asked Mar 22, 2021 in JavaScript by Robindeniel
0 votes
asked Mar 23, 2021 in JavaScript by sharadyadav1986
...