PDA

View Full Version : [RESOLVED] Deleting property in Object?


robkar97
12-19-2008, 05:19 AM
How should I do to remove a property of an Object (I hope that is the right description)?

Eg, I got

var coffee={small:'espresso', medium:'cafe au lait', large:'cappuccino'}

now I would like to remove the "medium" entry... not just filling it will null but removing it altogether. :confused:

Robert

rangana
12-20-2008, 09:12 AM
delete coffee.medium;


For further reading:
https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Creating_New_Objects/Deleting_Properties

robkar97
12-20-2008, 12:46 PM
Haha! Seems pretty straight forward :-) Thanks.