Operators
delete operator
Attempts to remove a property. Ordinary configurable own properties can be removed; nonconfigurable ones cannot, and strict-mode failure throws. Deleting a missing own property usually succeeds. Does not delete an inherited property from its prototype.
Formal Syntax & Structure
javascript syntaxjavascript
delete object[key]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| target | property reference | Property to remove. |
Return Value
boolean
True for successful deletion; false for some non-strict failures.
Working Example
Example Snippetjavascript
const a={n:1};console.log(delete a.n,"n" in a);