The deleteProperty trap is executed when we delete a property using either the delete operator or the Reflect.deleteProperty() method. It takes two parameters--that is, the target object and the property name.
This trap must return a Boolean, indicating whether the property was deleted successfully or not. Here is a code example that demonstrates how to use the deleteProperty trap:
const proxy = new Proxy({age: 12}, { deleteProperty(target, property) { return delete target[property]; } }); Reflect.deleteProperty(proxy, "age"); console.log(proxy.age); //Output "undefined"