LearnFrenzy
Sign in Take a free test

Destructuring · Destructuring MCQ · Question 11

Variables from a nested pattern Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 11 Back to Exercise

After const { address: { city } } = user;, which variables exist?

  • A address and city
  • B Only city Correct
  • C Only address
  • D user, address and city
Correct Answer: Option B

address is just the path to city. To have both, write const { address, address: { city } } = user;.

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