ES6 - Use Destructuring Assignment to Assign Variables from Arrays

Hello everyone, Can someone tell me how to choose the index of the element inside the array, by using destructuring assignment to assign variables from arrays.

Your code so far

const myBirthYear = 2005;

const myBirthMonthAndDay = [0, 7, 27];

const myBirthDate = [myBirthYear,, myBirthMonthAndDay];

Challenge: ES6 - Use Destructuring Assignment to Assign Variables from Arrays

Link to the challenge:

1 Like

try :

const myBirthDate = [myBirthYear,, ...myBirthMonthAndDay];
1 Like
  1. This is an example based on your code provided in the post:

The date gotten here is 7 1 2005.

  1. A variation (with a slightly different result look) could look like this:

P.S.
This problem is not connected to the challenge you have posted a link to. Please, stick to the course challenges. Post your private code and issues you have encountered under the ‘general’ category.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.