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: 2
};
Object.seal(object1);
obj1.property1 =4;
console.log(obj1.property1);
delete obj1.property1;

What will be the output of the following JavaScript code?
const obj1 = {
property1: 2
};
Object.seal(object1);
obj1.property1 =4;
console.log(obj1.property1);
delete obj1.property1;
a) 2
b) 4
c) error
d) undefined

Answer: c
Explanation: The seal property does not allow the object to be deleted. The object to be sealed is passed as an argument, and the method returns the object which has been sealed.

Join The Discussion