I have an object that is converted using Object.keys()
where the keys are stored in array. I am trying to loop through the array to splice out keys that are not needed for the rest of my function that I am trying to write.
var objectDef = {
pitcher: 'dave',
runner: 'joel',
umpire: 'kevin',
action/0/id: 1,
action/0/name: 'review',
action/0/killjoy: 'no'
}
//define array of keys
var givenObject = typeof objecDef == "object" ? Object.keys(objectDef) : [objectDef];
How would I go about splicing out splicing action/0/killjoy and action/0/name? I only want pitcher, runner, umpire, and action/0/id returned. These unwanted fields may or may not exist depending on the data that is received from the server.