this time, I am writing codes with Javascript. I have some problems that I can't delete specific object from an Array by using map method.
this code below totally works, but I don't wanna do this, because other people don't know what I am deleting unless they know the objects in Array.
listThatHasEverythingButBrokenObject: function() { const engineCollection = this.masterCollection.where({ table_name: "item", column_name: "engine", }) console.log(engineCollection) ←A engineCollection.splice(1,1) return engineCollection },
just to make sure, if If I console.log(engineCollection) A, it says something like this. [n, n, n, n] and in n,there is something like this. {attributes:{id:1, table_name: "item", column_name: "engine"}}
this code above works but nobody knows why I delete the object that is (1,1)
so I wanted to do something like this below.
listThatHasEverythingButBrokenObject: function() { const engineCollection = this.masterCollection.where({ table_name: "item", column_name: "engine", }) const brokenList= this.masterCollection.where({ table_name: "item", column_name: "engine", label_key: "broken", }) I want to do something with map method or filter and find a brokenList object from engineCollection and delete it or make a array without brokenList. return engineCollection },
Please kindly help me thank you.
https://stackoverflow.com/questions/66961523/how-can-i-delete-specific-object-from-an-array-that-ha-the-object-in-javascript April 06, 2021 at 09:06AM
没有评论:
发表评论