2015-04-06

JavaScript - How to remove a property from an existing object

var myObject = { };
myObject["myProperty"] = {};
myObject["myProperty"]["mySubProperty"] = "mySubProperty value here.";

console.log( 'Before: ');
console.log( myObject );

console.log( 'After removing myProperty.mySubProperty:' );
delete myObject.myProperty.mySubProperty;
console.log( myObject );

No comments:

Post a Comment