delete operator removes a property from an object.
On successful deletion, it will return true, else false will be returned.
The following are the key points to be noted while using
- If the property which you are trying to delete does not exist, delete will not have any effect and will return true.
- Any property declared with const or let cannot be deleted from the scope within which they were defined.
- Any property declared with var cannot be deleted from the global scope or from a function's scope.
- Non-configurable properties such as built-in objects like Math, Array and methods like Object.defineProperty() cannot be removed.
Using Dot Notation
Using Bracket Notation
|object||Required||The name of an object.|
|propertyName||Required||The property to delete.|
Please do google search for:
Join Our Channel
This channel is primarily useful for Full Stack Web Developer.