An object is written in a key/value pair. The key/value pair is called a property. For example,
const student = {
name: 'John',
age: 22
}
Here, name: 'John' and age: 22 are the two properties of a student object.
Example: Remove a Property From an Object
Output
{
age: 20,
hobbies: ["reading", "games", "coding"],
name: "John"
}
In the above program, the delete operator is used to remove a property from an object.
You can use the delete operator with . or [ ] to remove the property from an object.
Note: You should not use the delete operator on predefined JavaScript object properties.