I have an array, and I want to delete elements that have status equal to true (as seen in this part of code)
listArray.forEach((element, index) => {
if (element.status === true) {
listArray.splice(index, 1);
}
});
The problem is that, if, for example, the first
, second
and third
elements have status true
, than the second element will not be deleted