Can you use destructuring assignment to assign default values to variables?

  • Yes
  • No
  • Only for primitive data types
  • Only for arrays
Yes, destructuring assignment in ES6 allows you to assign default values to variables. If the assigned value is undefined, the variable takes the default value specified. This feature enhances flexibility in handling variable assignments.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *