Javascript examples for Language Basics:Introduction
delete a property or method from an object using the delete keyword.
<!DOCTYPE HTML> <html> <head> <title>Example</title> </head> <body> <script type="text/javascript"> var myData = {//from w w w . j av a 2s .c o m name: "java2s.com", topic: "CSS", }; myData.sayHello = function() { document.writeln("Hello"); }; delete myData.name; delete myData["topic"]; delete myData.sayHello; </script> </body> </html>