Question 4
Back to Exercise
What does the following JavaScript code print (console output, as in Node.js)?
const o = { a: 1 };
console.log(delete o.a, delete o.zzz, o);
- A true false {}
- B false false { a: 1 }
- C true undefined {}
- D true true {} Correct
Correct Answer: Option D
delete returns true when the property is gone afterwards – including when it never existed.
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!