I was struggling to get the last object item from a nested array. I tried to implement flatMap, flat, filter, and splice. However, I can not still get the expected array.
const array = [
[
{
total_cases: 18,
},
{
total_cases: 32,
},
{
total_cases: 7,
},
],
[
{
total_cases: 4,
},
{
total_cases: 52,
},
],
[
{
total_cases: 68,
},
],
];
I have an array like the above. How can I get only the last-object item into a new array?
Expected new array should be like this:
[7, 52, 68]
Thanks in advance!