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

const obj1 ={ property1:'15'};  

const obj2 =Object.freeze(obj1);  

obj2.property1='20';  

console.log(obj2.property1);  

a) Runtime error

b) 20

c) 15

d) Compilation error

1 Answer

0 votes
by

Answer: C

Reason: The object.freeze () method is used to "freeze" the properties of an object and also avoids adding new properties to it. This avoids manipulation/change in all existing values, properties, and attributes

...