In JavaScript, you can remove a property from an object using the delete
operator. Here's how you can do it:
let obj = {
property1: 'value1',
property2: 'value2',
// other properties...
};
// To remove property1 from the object
delete obj.property1;
After this operation, obj
will no longer have property1
. Please note that delete
operator returns true
if the property has been successfully deleted, and false
if the property can't be deleted (like some built-in properties).