You can remove properties (fields) from the JavaScript objects using the delete
keyword.
const user = {
name: 'John',
age: '25',
isLearning: true
};
delete user.age;
delete user['isLearning'];
console.log(user.name); // John
console.log(user.age); // undefined
console.log(user.isLearning); // undefined
In the example above I’ve deleted two fields from the JS object.
Then I logged them to the console to make sure these fields are evaluated to undefined
.