javascript delete key of object code example
Example 1: js remove key from object
// Example 1
var key = "Cow";
delete thisIsObject[key];
// Example 2
delete thisIsObject["Cow"];
// Example 3
delete thisIsObject.Cow;
Example 2: javascript remove function from object
var obj = {
func: function(a, b) {
return a + b;
}
};
delete obj.func;
obj.func(); // Uncaught TypeError: obj.func is not a function