var obj : Object =
{
name: "Datsun 120Y",
colour: "Powder blue",
value: 700.00
};
trace(ObjectUtil.toString(obj));
Gives us:
(Object)#0 colour = "Powder blue" name = "Datsun 120Y" value = 700We're being generous with the valuation here, but you get the idea!
Anyway, say we'd like to keep the object around, but we no longer want to keep the colour or the price information. We could try this:
obj.colour = null; obj.value = null; trace(ObjectUtil.toString(obj));But we still have the fields, as you can see below
(Object)#0 colour = (null) name = "Datsun 120Y" value = (null)The answer is the delete operator! Observe:
delete obj.colour; delete obj.value; trace(ObjectUtil.toString(obj));
(Object)#0 name = "Datsun 120Y"And our problems are solved! This may seem like a useless trick, but it's a trivial example. Let's say you're calling a service via SOAP, and one of the parameters is a number, and it's optional (minOccurs="0"). You can't pass in NaN because it's not a valid XSD number. You can't pass null, because the element hasn't been marked as xsd:nillable="true" - one way way is to clone the entire object without that field. Or, use the delete operator to remove it from your argument map object.

