Question 10
Back to Exercise
What does the following JavaScript code print (console output, as in Node.js)?
const s = Object.seal({ a: 1 });
s.a = 2;
s.b = 3;
delete s.a;
console.log(s, Object.isSealed(s), Object.isFrozen(s));
- A { a: 1 } true true
- B { a: 2 } true false Correct
- C { b: 3 } true false
- D {} true false
Correct Answer: Option B
A sealed object allows changing existing values but not adding or deleting properties (silently ignored here). It is not frozen because a is still writable.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!