![]() |
VOOZH | about |
JavaScript Reflect.deleteProperty() method in JavaScript is used to delete a property on an object. It returns a Boolean value which indicates whether the property was successfully deleted.
Syntax:
Reflect.deleteProperty( target, propertyKey )
Parameters: This method accepts two parameters as mentioned above and described below:
Return Value: This method returns a Boolean value that indicates whether the property was successfully deleted.
Exceptions: A TypeError is an exception given as the result when the target is not a constructor.
Example 1: In this example, we will delete a property of an object using Reflect.deleteProperty() method in Javascript.
undefined [ 1, 2, 3, 4, 5 ] [ 1, <1 empty item>, 3, 4, 5 ] [ 1, <2 empty items>, 4, 5 ]
Example 2: In this example, we will delete a property of an object using Reflect.deleteProperty() method in Javascript.
true false true true
The browsers supported by Reflect.deleteProperty() method are listed below:
We have a complete list of Javascript Reflects methods, to check those go through the JavaScript Reflect Reference article.