I have a specific object structured as follows:
var myObj: {
2:"None",
20:"A",
31:"A",
32:"A",
Social:"B",
Method:"None"
}
My goal is to retrieve the object without the properties 'Social' and 'Method'.
Initially, I attempted to remove these properties within a computed property function, but it ended up deleting them from the main object entirely:
props: ['myObj']
computed: {
filterOut: {
var myObject = this.myObj
delete myVar['Social'];
delete myVar['Method'];
return myObject
}
}
Subsequently, I tried utilizing the filter method, only to encounter an error:
var myObject = this.myObj.filter(key => {
return key != 'Method' || key != 'Social'
})
return myObject
TypeError: this.myObj.filter is not a function
What would be the most effective approach to obtain the below object based on the initial one?
var myObj: {
2:"None",
20:"A",
31:"A",
32:"A"
}