Within my Angular application, there exists a function that navigates through an array and then utilizes a filter function to extract values into a new array where the "completed" key is set to "false".
The functionality is performing as expected. Our data structure guarantees the presence of one object in the array with the "completed" property set as "false", enabling direct targeting using [0]. The only remaining task is to update this value to "true". Despite numerous attempts, I am struggling with achieving this final step.
Here is the entirety of my function alongside the approaches I have explored so far:
private completeLastWorkflowStatus() {
let currentService = this.checkDiscipline();
for (let service of this.client.services) {
if (service.service === currentService) {
let targetWorkflow = service.workflow;
let incompleteWorkflow = targetWorkflow.filter(workflow => workflow.completed === false);
console.log(incompleteWorkflow);
if (incompleteWorkflow[0].completed === false) {
incompleteWorkflow[0].completed === true;
console.log(incompleteWorkflow[0].completed);
}
}
}
}
Despite the introduction of the aforementioned console.log statement, "false" continues to be displayed. What piece of the puzzle am I failing to grasp? How can I successfully alter the value of "completed" to "true" for this specific object within the array?