trying to get better grasp on destructuring.
If I have object like this:
const starWars = {
count: 2,
data: [
{name: 'Luke Skywalker', films: ['Empire Strikes Back', 'The Force Awakens']},
{name: 'Han Solo', films: ['New Hope', 'Return of the Jedi']}
]};
I can destructure data part like this:
const {data: allCharMovies} = starWars;
console.log(allCharMovies[1].name);
or I can try to do:
const { count, data: [{name: nameCh, films: movies}]} = starWars;
console.log(nameCh, movies[1]);
But but that only gives my movies for "Luke Skywalker" - how can I access "Han Solo" part if I do it the second way?