Javascript examples for Operator:delete
The delete operator deletes both the value of the property and the property itself from object.
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var person = {/*from www . j av a2 s. c o m*/ firstname:"Mary", lastname:"Bond", age:50, eyecolor:"blue" }; delete person.age; document.getElementById("demo").innerHTML = person.firstname + " is " + person.age + " years old."; </script> </body> </html>