Suppose you have an instance of an object, obj
, and want to unset set a property called prop
. What are the ultimate differences with the following two variants:
delete obj.prop;
obj.prop = undefined;
I believe that these both have the same meaning, but in the case of setting the property to undefined, the reference to the property does not have to be removed so a little work is saved. Correct me if I'm wrong.