VOOZH about

URL: https://www.geeksforgeeks.org/javascript/javascript-handler-deleteproperty-method/

⇱ JavaScript Handler deleteProperty() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

JavaScript Handler deleteProperty() Method

Last Updated : 12 Jul, 2025

JavaScript handler.deleteProperty() method in JavaScript is a trap for the delete operator. This method returns the boolean value if the delete was successful.

Syntax: 

const p = new Proxy(target, {
 deleteProperty: function(target, property) {
 }
});

Parameters: This method accepts two parameters as mentioned above and described below: 

  • Target: This parameter holds the target object.
  • Property: This parameter holds the name of the property which is to be deleted.

Return value: This method returns a Boolean value that indicates whether the property was successfully deleted.

Below examples illustrate the handler.deleteProperty() method in JavaScript:

Example 1: In this example, we will trap a delete operator using the handler.deleteProperty() method in JavaScript.
 

Output: 

"Green"
"Color is property which is removed"
undefined
true
false

Example 2: In this example, we will trap a delete operator using the handler.deleteProperty() method in JavaScript.

Output: 

true
"prop1 property is removed."
true
false
"prop1 property is not removed."
false

Supported Browsers: The browsers supported by the handler.deleteProperty() method are listed below: 

  • Google Chrome 49 and above
  • Edge 12 and above
  • Firefox 18 and above
  • Opera 36 and above
  • Safari  10 and above

We have a complete list of Javascript Proxy/handler methods, to check those go through the Javascript Proxy/handler Reference article.

Comment