LearnFrenzy
Sign in Take a free test

Objects · JavaScript Objects MCQ · Question 4

What does delete return? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 4 Back to Exercise

What does delete user.middleName return when user has no such property?

  • A true – deleting a property that does not exist still succeeds Correct
  • B false
  • C undefined
  • D It throws a ReferenceError
Correct Answer: Option A

delete returns false only when a property exists but cannot be deleted (non-configurable, in sloppy mode). In strict mode that case throws instead.

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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links