JavaScript: delete Operator
Description
The delete operator deletes an object, an object's property, or an element from an array. The operator can also delete variables which are not declared with the var statement.
Version
Implemented in JavaScript 1.2
Syntax
delete objectName delete objectName.property delete objectName[index] delete property // The command acts only within a with statement.
Parameters
objectName:The name of an object.
property: The property is an existing property.
index: An integer representing the array index.
Example:
The following web document demonstrates the use of delete operator.
HTML Code
JS Code
See also
Conditional Operator
comma
function
in
instanceof
new
this
typeof
void
Want to Test your JavaScript skill ?
Want to Practice JavaScript exercises ?
- JavaScript basic [ 13 Exercises with Solution ]
- JavaScript functions [ 21 Exercises with Solution ]
- JavaScript conditional statements and loops [ 10 Exercises with Solution ]
- JavaScript array [ 13 Exercise with Solution ]
- JavaScript regular expression [ 6 Exercises with Solution ]
- JavaScript HTML DOM [ 14 Exercises with Solution ]
- JavaScript Drawing [ 5 Exercises with Solution ]
- JavaScript Object [ 4 Exercises with Solution ]
Previous: JavaScript: Comma Operator
Next: JavaScript: function Operator
Test your Programming skills with w3resource's quiz.