Let's say we have an array with this format:
var thisIsArray = {
'Cow' : 'Moo',
'Cat' : 'Meow',
'Dog' : 'Bark'
};
i wanted to do a function that removes by key:
removeFromArrayByKey('Cow');
Let's say we have an array with this format:
var thisIsArray = {
'Cow' : 'Moo',
'Cat' : 'Meow',
'Dog' : 'Bark'
};
i wanted to do a function that removes by key:
removeFromArrayByKey('Cow');
function removeFromArrayByKey(key) {
delete thisIsArray[key];
}
But I would probably keep it simple and not use the function.
delete thisIsArray[key];