tags:

views:

34

answers:

1

Is it possible to remove an element of a Javascript associative array (i.e., set back to native undefined)?

When I tried simply alert(array['knownKey']); array['knownKey']=undefined; alert(array['knownKey']); ... the second alert produced the literal undefined... whereas, the first alert returned nothing.

+1  A: 

To actually delete an element, use

delete array['knownkey'];
KennyTM
very helpful coming from php dev perspective - lack of `unset()`
ina