The JavaScript Reflect.deleteProperty() method deletes a property of an object.
Syntax:
Reflect.deleteProperty(target, propertyKey)
Parameters:
target: It represents the object whose property have to be deleted.
propertyKey: It represents the name of the property to be deleted.
Return:
It returns true if the specified property is successfully deleted otherwise, it returns false.
Example 1:
<!DOCTYPE html> <html> <body> <script> var n = [1100, 2200, 3100, 4100, 5100]; Reflect.deleteProperty(n, '1'); document.write(n); </script> </body> </html>
Example 2:
<!DOCTYPE html> <html> <body> <script> const object1 = { property1: 442 }; Reflect.deleteProperty(object1, 'property1'); document.write(object1.property1); document.write("</br>"); var array1 = [11, 32, 35, 14, 5]; Reflect.deleteProperty(array1, '32'); document.write(array1); </script> </body> </html>