I'm trying to divide one array into two depending on a condition, i have an array that i have already filtered and i'm doing a forEach to loop trough it:
pending.forEach((items) => {
console.log(items);
});
That console.log, prints this:
{year:2020, month:3, dates:[null, null, null, null, "01-01-2020", null]}
{year:2020, month:12, dates:[null, null, "10-03-2020", null, "01-01-2020", null]}
What i need to do is separate every item in two, to have one array with the dates that are null, and the other one with the dates that are different from null and maybe add a state, so in this case, i should have 2 arrays on the first item:
{year:2020, month:3, dates:[null, null, null, null, null]},
{year:2020, month:3, dates:[ "01-01-2020"]}
But i don't know how to access the dates, to then ask if the date is null or not.
Can anyone help me with this?