I am trying to return the entire object where linkable is set to true. Even though I am pushing the objects, the this.releaseDescriptionDatesArray remains empty. It seems like my logic is correct, so not sure why the array is not populating.
for (const item of this.datesArray) {
for (const attribute in item) {
if (attribute === 'linkable' && item[attribute] === true) {
this.releaseDescriptionDatesArray.push(item); // data is being pushed
console.log(this.releaseDescriptionDatesArray, "datesArr"); // data is not showing here
}
}
}
console.log(this.releaseDescriptionDatesArray, "datesArr"); // data doesn't appear here
}
Sample data
datesArray = [ {
"type": "disasterRecovery",
"date": "2019-07-28",
"releaseWindow": {
"start": null,
"end": null
},
"description": "Disaster Recovery",
"linkable": true
},
{
"type": "nooutageRelease",
"date": "2019-08-03",
"releaseWindow": {
"start": "2019-08-04T00:00:00",
"end": "2019-08-04T23:59:59"
},
"description": "Infrastructure Release (No Outage)",
"linkable": true
}]