How to Remove a property from a JavaScript object


To remove a property from a JavaScript object, you can use the delete operator. Here is an example code snippet:

const obj = { firstNamea: "javasavvy", email: "test@gmail,com", password: "test };

// Remove the property 'password' from the object
delete obj.password;

console.log(obj); // { firstNamea: "javasavvy", email: "test@gmail,com"};


In this example, the delete operator is used to remove the property ‘password’ from the object obj. After the property is removed, the remaining properties are logged to the console using console.log().