Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to delete object properties in javascript

// Creates a new object, myobj, with two properties, a and b.
var myobj = new Object;
myobj.a = 5;
myobj.b = 12;

// Removes the a property, leaving myobj with only the b property.
delete myobj.a;
console.log ('a' in myobj); // output: "false"
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #delete #object #properties #javascript
ADD COMMENT
Topic
Name
9+3 =