Dictionary.Key() (Method)

Returns a reference to the named key container.


JScript - 3.0
Internet Explorer - 4.0
Property/method value type:Reference to a key name pocket
JavaScript syntax:IEmyDictionary.Key(anOldKey) = aNewKey
Argument list:anOldKeyAn existing key name
aNewKeyA new name to rename the existing key to

This method provides a reference to the receptacle containing the key name. This 'by-reference' access to the key allows the key to be changed. You would not be able to do that if it accessed the key name by value.

Because you are referencing the container of the key, you can use this method as an LValue and assign a new value to the key. This is effectively a key rename mechanism.

If the key does not already exist, like the Item() method, this will create a new named but empty item in the Dictionary.