LearnFrenzy
Sign in Take a free test

Destructuring · Destructuring MCQ · Question 4

Rename and default together Answer, explanation & discussion

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

Which pattern reads obj.size into a variable s, defaulting to 10?

  • A const { size: s = 10 } = obj; Correct
  • B const { s: size = 10 } = obj;
  • C const { size = 10: s } = obj;
  • D const { s = size: 10 } = obj;
Correct Answer: Option A

The order is property : variable = default.

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