I’m trying to remove an object from (inside?) a object literal. But I cant figure out why it doenst work.
var data=
{
"car": 3,
"boat": 2
};
data.pop(); //should remove last one?
data.splice(1, 1); // removes element with index 1?
What am I doing wrong here? And is it posible you delete the item by name? Let say remove boat.
Since its a Object not an array, delete should work
Like this:
See it in action :
JSFiddle