delete

The delete operator deletes an object’s property or an element at a specified index in an array.

Syntax

delete objectName.property
delete objectName[index]
delete property

Parameters

objectName—The name of an object.

property—An existing property.

index—An integer representing the location of an element in an array.

Description

The third form is legal only within a with statement.

If the deletion succeeds, the delete operator sets the property or element to undefined. delete always returns undefined.