Home »
MCQs »
JavaScript MCQs
What is the output of the following JavaScript code? | Question 23
80. What will be the output of the following JavaScript code?
<script>
try{
const cars = {
company: 'Honda'
};
Object.seal(cars);
delete cars.company;
document.write(cars.company);
}
catch (err){
document.write(err.message);
}
</script>
- undefined
- Honda
- ValueError
- TypeError
Answer: B) Honda
Explanation:
In the above JavaScript code, we have sealed the object and the seal property does not allow the object to be deleted. Hence, the property company will not be deleted.